org.apache.catalina.startup.Tomcat.stop()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(4.2k)|赞(0)|评价(0)|浏览(152)

本文整理了Java中org.apache.catalina.startup.Tomcat.stop()方法的一些代码示例,展示了Tomcat.stop()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tomcat.stop()方法的具体详情如下:
包路径:org.apache.catalina.startup.Tomcat
类名称:Tomcat
方法名:stop

Tomcat.stop介绍

[英]Stop the server.
[中]停止服务器。

代码示例

代码示例来源:origin: spring-projects/spring-framework

@Override
public void stop() throws Exception {
  this.tomcatServer.stop();
  this.port = 0;
}

代码示例来源:origin: org.springframework.boot/spring-boot

private void stopTomcat() throws LifecycleException {
  if (Thread.currentThread()
      .getContextClassLoader() instanceof TomcatEmbeddedWebappClassLoader) {
    Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
  }
  this.tomcat.stop();
}

代码示例来源:origin: AsyncHttpClient/async-http-client

@AfterClass(alwaysRun = true)
public void tearDownGlobal() throws Exception {
 tomcat.stop();
}

代码示例来源:origin: spring-projects/spring-framework

@Override
protected void stopInternal() throws Exception {
  this.tomcatServer.stop();
  this.tomcatServer.destroy();
}

代码示例来源:origin: AsyncHttpClient/async-http-client

@AfterClass(alwaysRun = true)
public void tearDownGlobal() throws Exception {
 tomcat.stop();
 executor.shutdown();
}

代码示例来源:origin: apache/incubator-dubbo

@Override
  public void close() {
    super.close();

    ServletManager.getInstance().removeServletContext(url.getPort());

    try {
      tomcat.stop();
    } catch (Exception e) {
      logger.warn(e.getMessage(), e);
    }
  }
}

代码示例来源:origin: apache/incubator-dubbo

@Override
  public void close() {
    super.close();

    ServletManager.getInstance().removeServletContext(url.getPort());

    try {
      tomcat.stop();
    } catch (Exception e) {
      logger.warn(e.getMessage(), e);
    }
  }
}

代码示例来源:origin: OryxProject/oryx

@Override
public synchronized void close() throws IOException {
 if (tomcat != null) {
  try {
   tomcat.stop();
   tomcat.destroy();
  } catch (LifecycleException le) {
   log.warn("Unexpected error while stopping", le);
  } finally {
   tomcat = null;
  }
  IOUtils.deleteRecursively(noSuchBaseDir);
 }
}

代码示例来源:origin: line/armeria

@AfterClass
public static void destroyTomcat() throws Exception {
  if (tomcatWithWebApp != null) {
    tomcatWithWebApp.stop();
    tomcatWithWebApp.destroy();
  }
  if (tomcatWithoutWebApp != null) {
    tomcatWithoutWebApp.stop();
    tomcatWithoutWebApp.destroy();
  }
}

代码示例来源:origin: oblac/jodd

@Override
  public void stop() throws Exception {
    tomcat.stop();
    tomcat.destroy();
    super.stop();
  }
}

代码示例来源:origin: SonarSource/sonarqube

void terminate() {
 if (tomcat.getServer().getState().isAvailable()) {
  try {
   tomcat.stop();
   tomcat.destroy();
  } catch (Exception e) {
   Loggers.get(EmbeddedTomcat.class).error("Fail to stop web server", e);
  }
 }
 deleteQuietly(tomcatBasedir());
}

代码示例来源:origin: pippo-java/pippo

@Override
public void stop() {
  if (tomcat != null) {
    try {
      tomcat.stop();
    } catch (Exception e) {
      throw new PippoRuntimeException(e, "Cannot stop Tomcat Server");
    }
  }
}

代码示例来源:origin: spring-projects/spring-integration

@Override
public void destroy() throws Exception {
  this.tomcatServer.stop();
}

代码示例来源:origin: spring-projects/spring-restdocs

@Override
protected void after() {
  try {
    this.tomcat.stop();
  }
  catch (LifecycleException ex) {
    throw new RuntimeException(ex);
  }
}

代码示例来源:origin: camunda/camunda-bpm-platform

public void stop() {
 try {
  try {
   tomcat.stop();
  } catch (Exception e) {
   Logger.getLogger(getClass().getName()).log(Level.WARNING, "Failed to stop tomcat instance", e);
  }
  try {
   tomcat.destroy();
  } catch (Exception e) {
   Logger.getLogger(getClass().getName()).log(Level.WARNING, "Failed to destroy instance", e);
  }
  tomcat = null;
 } catch (Exception e) {
  throw new RuntimeException(e);
 }
}

代码示例来源:origin: apache/cxf

public void tearDown() throws Exception {
    super.tearDown();

    if (server != null) {
      server.stop();
      server.destroy();
      server = null;
    }
  }
}

代码示例来源:origin: io.hops/hadoop-auth

protected void stopTomcat() throws Exception {
 try {
  tomcat.stop();
 } catch (Exception e) {
 }
 try {
  tomcat.destroy();
 } catch (Exception e) {
 }
}

代码示例来源:origin: com.alibaba/dubbo

@Override
  public void close() {
    super.close();

    ServletManager.getInstance().removeServletContext(url.getPort());

    try {
      tomcat.stop();
    } catch (Exception e) {
      logger.warn(e.getMessage(), e);
    }
  }
}

代码示例来源:origin: apache/cxf

public void tearDown() throws Exception {
    super.tearDown();

    if (server != null) {
      server.stop();
      server.destroy();
      server = null;
    }
  }
}

代码示例来源:origin: apache/eagle

public void shutdown() throws Throwable {
    if (tomcat.getServer() != null && tomcat.getServer().getState() != LifecycleState.DESTROYED) {
      if (tomcat.getServer().getState() != LifecycleState.STOPPED) {
        tomcat.stop();
      }
      tomcat.destroy();
    }
  }
}

相关文章