예제 #1
0
 /** Un-initialization. */
 @Override
 public void destroy() throws Exception {
   log.debug("TomcatVHostLoader un-init");
   Container[] children = host.findChildren();
   for (Container c : children) {
     if (c instanceof StandardContext) {
       try {
         ((StandardContext) c).stop();
         host.removeChild(c);
       } catch (Exception e) {
         log.error("Could not stop context: {}", c.getName(), e);
       }
     }
   }
   // remove system prop
   String propertyPrefix = name;
   if (domain != null) {
     propertyPrefix += '_' + domain.replace('.', '_');
   }
   System.clearProperty(propertyPrefix + ".webapp.root");
   // stop the host
   try {
     ((StandardHost) host).stop();
   } catch (LifecycleException e) {
     log.error("Could not stop host: {}", host.getName(), e);
   }
   // remove host
   engine.removeChild(host);
   // unregister jmx
   unregisterJMX();
 }
예제 #2
0
 @Override
 public void stop(StopContext stopContext) {
   registration.unregister();
   try {
     context.stop();
   } catch (LifecycleException e) {
     WEB_LOGGER.stopContextFailed(e);
   }
   try {
     context.destroy();
   } catch (Exception e) {
     WEB_LOGGER.destroyContextFailed(e);
   }
 }
예제 #3
0
 private static void stopWebApp(StandardContext context) throws Exception {
   try {
     Container container = context.getParent();
     container.removeChild(context);
     context.stop();
   } catch (LifecycleException e) {
     throw MESSAGES.stopContextPhaseFailed(e);
   }
   try {
     context.destroy();
   } catch (Exception e) {
     throw MESSAGES.destroyContextPhaseFailed(e);
   }
 }
 @Override
 public synchronized void stop() throws Exception {
   if (_serverContext != null) {
     // Destroy the web context unless if it is default
     if (!_serverContext.getPath().equals("/")) {
       try {
         Container container = _serverContext.getParent();
         container.removeChild(_serverContext);
         _serverContext.stop();
         _serverContext.destroy();
         _log.info("Destroyed HTTP context " + _serverContext.getPath());
       } catch (Exception e) {
         _log.error("Unable to destroy web context", e);
       }
     }
   }
 }