org.apache.catalina.Context.destroy()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(3.5k)|赞(0)|评价(0)|浏览(102)

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

Context.destroy介绍

暂无

代码示例

代码示例来源:origin: com.github.skjolber.mockito-rest-spring/tomcat

private void destroy(Context context) throws LifecycleException, InterruptedException {
    context.destroy();

    long deadline = System.currentTimeMillis() + 10000;
    do {
      switch(context.getState()) {
      case DESTROYED:
      case FAILED:
        return;
      default : {
      }
      }
      Thread.sleep(10);
    } while(deadline > System.currentTimeMillis());		
  }    
}

代码示例来源:origin: org.apache.openejb/tomee-webservices

@Override
  public HttpListener removeListener(final String completePath) {
    String path = completePath;
    if (path == null) {
      return listeners.get(path);
    }

    // assure context root with a leading slash
    if (!path.startsWith("/") && !path.startsWith("http://") && !path.startsWith("https://")) {
      path = "/" + path;
    }

    if (TomcatHelper.isTomcat7() && TomcatHelper.isStopping() && listeners.containsKey(path)) {
      return listeners.get(path);
    }

    Context context = contexts.remove(path);
    try {
      context.stop();
      context.destroy();
    } catch (Exception e) {
      throw new TomEERuntimeException(e);
    }
    Host host = (Host) context.getParent();
    host.removeChild(context);

    return listeners.remove(completePath);
  }
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

if(context instanceof StandardContext)
try {
  context.destroy();
} catch (Exception e) {
  log.warn("Error during context [" + context.getName() + "] destroy ", e);

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

if(context instanceof StandardContext)
try {
  context.destroy();
} catch (Exception e) {
  log.warn("Error during context [" + context.getName() + "] destroy ", e);

代码示例来源:origin: org.apache.openejb/tomee-webservices

public void removeWsContainer(String path) {
  if (path == null) return;
  // assure context root with a leading slash
  if (!path.startsWith("/")) path = "/" + path;
  if (TomcatHelper.isTomcat7() && TomcatHelper.isStopping()) {
    return;
  }
  Context context = webserviceContexts.remove(path);
  if (WEBSERVICE_OLDCONTEXT_ACTIVE) {
    try {
      context.destroy();
      context.stop();
    } catch (Exception e) {
      throw new TomEERuntimeException(e);
    }
    Host host = (Host) context.getParent();
    host.removeChild(context);
  } // else let tomcat manages its context
}

代码示例来源:origin: com.github.mjeanroy/junit-servers-tomcat

@Override
protected void doStop() {
  try {
    tomcat.stop();
    // Do not forget to destroy context
    if (context != null) {
      context.destroy();
      context = null;
    }
    if (!configuration.isKeepBaseDir()) {
      deleteDirectory(configuration.getBaseDir());
    }
  }
  catch (Exception ex) {
    throw new ServerStopException(ex);
  }
}

代码示例来源:origin: org.wso2.carbon.commons/org.wso2.carbon.url.mapper.clustermessage

public static void removeVirtualHost(String hostName) {
  Engine engine = DataHolder.getInstance().getCarbonTomcatService().getTomcat().getEngine();
  Host host = (Host) engine.findChild(hostName);
  Context context = (Context) host.findChild("/");
  try {
    if (host.getState().isAvailable()) {
      if (context != null && context.getAvailable()) {
        context.setRealm(null);
        context.stop();
        context.destroy();
        log.info("Unloaded webapp from the host: " + host
            + " as the context of: " + context);
      }
      host.removeChild(context);
      host.setRealm(null);
      host.stop();
      host.destroy();
      engine.removeChild(host);
    }
  }catch (LifecycleException e) {
    log.error("error while removing host from tomcat", e);
  }
  URLMappingHolder.getInstance().removeUrlMappingMap(
      host.getName());
  log.info("Unloaded host from the engine: " + host);
}
public static Host addHostToEngine(String hostName) {

相关文章

微信公众号

最新文章

更多

Context类方法