Ejemplo n.º 1
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);
       }
     }
   }
 }