@Override public void stop(String name) throws Exception { Context ctx = findContext(name); if (ctx != null) { ctx.stop(); } }
public static void main(String args[]) { startReport(); Timer timer = metricRegistry.timer("computePi"); Timer.Context context = timer.time(); try { computePi(); } finally { context.stop(); } }
private void stop(Context context) throws LifecycleException, InterruptedException { context.stop(); long deadline = System.currentTimeMillis() + 10000; do { switch(context.getState()) { case STOPPED: case DESTROYING: case DESTROYED: case FAILED: return; default : { } } Thread.sleep(10); } while(deadline > System.currentTimeMillis()); }
@Override public HttpListener removeListener(final String completePath) { String path = completePath; if (path == null) { return listeners.get(path); } // assure context root with a leading slash if (!path.startsWith("/") && !path.startsWith("http://") && !path.startsWith("https://")) { path = "/" + path; } if (TomcatHelper.isTomcat7() && TomcatHelper.isStopping() && listeners.containsKey(path)) { return listeners.get(path); } Context context = contexts.remove(path); try { context.stop(); context.destroy(); } catch (Exception e) { throw new TomEERuntimeException(e); } Host host = (Host) context.getParent(); host.removeChild(context); return listeners.remove(completePath); } }
public void removeWsContainer(String path) { if (path == null) return; // assure context root with a leading slash if (!path.startsWith("/")) path = "/" + path; if (TomcatHelper.isTomcat7() && TomcatHelper.isStopping()) { return; } Context context = webserviceContexts.remove(path); if (WEBSERVICE_OLDCONTEXT_ACTIVE) { try { context.destroy(); context.stop(); } catch (Exception e) { throw new TomEERuntimeException(e); } Host host = (Host) context.getParent(); host.removeChild(context); } // else let tomcat manages its context }
log.debug(sm.getString("farmWarDeployer.undeployLocal", contextName)); context.stop(); String baseName = context.getBaseName(); File war = new File(host.getAppBaseFile(), baseName + ".war");
log.debug(sm.getString("farmWarDeployer.undeployLocal", contextName)); context.stop(); String baseName = context.getBaseName(); File war = new File(getAppBase(), baseName + ".war");
log.debug(sm.getString("farmWarDeployer.undeployLocal", contextName)); context.stop(); String baseName = context.getBaseName(); File war = new File(host.getAppBaseFile(), baseName + ".war");
return; context.stop(); writer.println(smClient.getString( "managerServlet.stopped", displayPath));
return; context.stop(); writer.println(smClient.getString( "managerServlet.stopped", displayPath));
return; context.stop(); writer.println(smClient.getString( "managerServlet.stopped", displayPath));
return; context.stop(); writer.println(smClient.getString( "managerServlet.stopped", displayPath));
return; context.stop(); writer.println(smClient.getString( "managerServlet.stopped", displayPath));
return; context.stop(); writer.println(smClient.getString( "managerServlet.stopped", displayPath));
return; context.stop(); writer.println(smClient.getString( "managerServlet.stopped", displayPath));
return; context.stop(); writer.println(smClient.getString( "managerServlet.stopped", displayPath));
try { context.stop(); } catch (Throwable t) { ExceptionUtils.handleThrowable(t);
try { context.stop(); } catch (Throwable t) { ExceptionUtils.handleThrowable(t);
try { context.stop(); } catch (Throwable t) { ExceptionUtils.handleThrowable(t);
public static void removeVirtualHost(String hostName) { Engine engine = DataHolder.getInstance().getCarbonTomcatService().getTomcat().getEngine(); Host host = (Host) engine.findChild(hostName); Context context = (Context) host.findChild("/"); try { if (host.getState().isAvailable()) { if (context != null && context.getAvailable()) { context.setRealm(null); context.stop(); context.destroy(); log.info("Unloaded webapp from the host: " + host + " as the context of: " + context); } host.removeChild(context); host.setRealm(null); host.stop(); host.destroy(); engine.removeChild(host); } }catch (LifecycleException e) { log.error("error while removing host from tomcat", e); } URLMappingHolder.getInstance().removeUrlMappingMap( host.getName()); log.info("Unloaded host from the engine: " + host); } public static Host addHostToEngine(String hostName) {