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

x33g5p2x  于2022-01-19 转载在 其他  
字(2.2k)|赞(0)|评价(0)|浏览(142)

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

Embedded.stop介绍

[英]Gracefully terminate the active use of the public methods of this component. This method should be the last one called on a given instance of this component.
[中]优雅地终止此组件的公共方法的活动使用。此方法应该是在此组件的给定实例上调用的最后一个方法。

代码示例

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

/**
 * Stops the embedded Tomcat server.
 */
public void stopContainer() {
 try {
  if (container != null) {
   container.stop();
   logger.info("Stopped container");
  }
 } catch (LifecycleException exception) {
  logger.warn("Cannot Stop Tomcat" + exception.getMessage());
 }
}

代码示例来源:origin: stackoverflow.com

try {
  if (container != null) {
    container.stop();

代码示例来源:origin: org.glassfish.web/web-glue

public void onTermination() 
  throws Exception {
  _started = false;
  _embedded.stop();
}

代码示例来源:origin: org.glassfish.main.web/web-core

@Override
public void destroy() throws LifecycleException {
  if( started ) stop();
  if (initialized) {
    initialized = false;
  }
}

代码示例来源:origin: org.testatoo.container/testatoo-container-tomcat

protected void stop(final Embedded server) {
  try {
    server.stop();
  } catch (LifecycleException e) {
    throw new RuntimeException(e.getMessage(), e);
  } finally {
    if (stop != null) stop.countDown();
    stop = null;
    serverThread = null;
  }
}

代码示例来源:origin: net.disy.legato/legato-testing

@Override
public void stop() throws Exception {
 synchronized (started) {
  if (!started) {
   throw new RuntimeException("Server was not yet started"); //$NON-NLS-1$
  }
  try {
   if (container != null) {
    container.stop();
    started = false;
   }
   else {
    throw new RuntimeException("Container is null"); //$NON-NLS-1$
   }
  }
  catch (final LifecycleException e) {
   logger.error("Could not stop server", e); //$NON-NLS-1$
  }
 }
}

代码示例来源:origin: org.apache.tapestry/tapestry-runner

/**
 * Immediately shuts down the server instance.
 */
@Override
public void stop()
{
  System.out.printf("Stopping Tomcat instance on port %d/%d\n", port, sslPort);
  try
  {
    // Stop immediately and not gracefully.
    tomcatServer.stop();
  }
  catch (Exception ex)
  {
    throw new RuntimeException("Error stopping Tomcat6 instance: " + ex.toString(), ex);
  }
  System.out.println("Tomcat instance has stopped.");
}

相关文章