List of usage examples for org.springframework.web.context ConfigurableWebApplicationContext stop
void stop();
From source file:org.red5.server.winstone.WinstoneApplicationContext.java
public void stop() { log.debug("stop"); try {/*from w ww .j av a 2 s . co m*/ Object o = context.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE); if (o != null) { log.debug("Spring context for {} was found", context.getContextName()); ConfigurableWebApplicationContext appCtx = (ConfigurableWebApplicationContext) o; //close the red5 app if (appCtx.isRunning()) { log.debug("Context was running, attempting to stop"); appCtx.stop(); } if (appCtx.isActive()) { log.debug("Context is active, attempting to close"); appCtx.close(); } } else { log.warn("Spring context for {} was not found", context.getContextName()); } } catch (Exception e) { log.error("Could not stop spring context", e); } context.destroy(); }
From source file:org.red5.server.undertow.UndertowApplicationContext.java
/** * Stop the application and servlet contexts. *//*from w w w . j a v a 2 s. c o m*/ public void stop() { log.debug("stop"); try { Deployment deployment = manager.getDeployment(); ServletContextImpl servlet = deployment.getServletContext(); Object o = servlet.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE); if (o != null) { log.debug("Spring context for {} was found", deployment.getDeploymentInfo().getContextPath()); ConfigurableWebApplicationContext appCtx = (ConfigurableWebApplicationContext) o; // close the red5 app if (appCtx.isRunning()) { log.debug("Context was running, attempting to stop"); appCtx.stop(); } if (appCtx.isActive()) { log.debug("Context is active, attempting to close"); appCtx.close(); } } else { log.warn("Spring context for {} was not found", deployment.getDeploymentInfo().getContextPath()); } } catch (Exception e) { log.error("Could not stop spring context", e); } manager.undeploy(); }
From source file:org.red5.server.tomcat.TomcatApplicationContext.java
public void stop() { log.debug("stop"); try {//from w ww . j a v a 2s . c o m ServletContext servlet = context.getServletContext(); Object o = servlet.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE); if (o != null) { log.debug("Spring context for {} was found", context.getName()); ConfigurableWebApplicationContext appCtx = (ConfigurableWebApplicationContext) o; //close the red5 app if (appCtx.isRunning()) { log.debug("Context was running, attempting to stop"); appCtx.stop(); } if (appCtx.isActive()) { log.debug("Context is active, attempting to close"); appCtx.close(); } } else { log.warn("Spring context for {} was not found", context.getName()); } } catch (Exception e) { log.error("Could not stop spring context", e); } context.getParent().removeChild(context); if (context instanceof StandardContext) { StandardContext ctx = (StandardContext) context; try { //stop the tomcat context ctx.stop(); } catch (Exception e) { log.error("Could not stop context", e); } finally { try { ctx.destroy(); } catch (Exception e) { log.error("Could not destroy context", e); } } } }