コード例 #1
0
ファイル: Catalina.java プロジェクト: glorydom321/MyTomcat
  /** Stop an existing server instance. */
  public void stop() {

    try {
      // Remove the ShutdownHook first so that server.stop()
      // doesn't get invoked twice
      if (useShutdownHook) {
        Runtime.getRuntime().removeShutdownHook(shutdownHook);

        // If JULI is being used, re-enable JULI's shutdown to ensure
        // log messages are not lost
        LogManager logManager = LogManager.getLogManager();
        if (logManager instanceof ClassLoaderLogManager) {
          ((ClassLoaderLogManager) logManager).setUseShutdownHook(true);
        }
      }
    } catch (Throwable t) {
      ExceptionUtils.handleThrowable(t);
      // This will fail on JDK 1.2. Ignoring, as Tomcat can run
      // fine without the shutdown hook.
    }

    // Shut down the server
    try {
      Server s = getServer();
      LifecycleState state = s.getState();
      if (LifecycleState.STOPPING_PREP.compareTo(state) <= 0
          && LifecycleState.DESTROYED.compareTo(state) >= 0) {
        // Nothing to do. stop() was already called
      } else {
        s.stop();
        s.destroy();
      }
    } catch (LifecycleException e) {
      log.error("Catalina.stop", e);
    }
  }
コード例 #2
0
ファイル: Tomcat.java プロジェクト: anoopgecbh/Tomcat-4
 /** Destroy the server. This object cannot be used once this method has been called. */
 public void destroy() throws LifecycleException {
   getServer();
   server.destroy();
   // Could null out objects here
 }