Java 类org.apache.catalina.core.ThreadLocalLeakPreventionListener 实例源码

项目:embed-apache-tomcat    文件:CatalinaBuilderImpl.java   
@Override
public TomcatHostBuilder newStandardServer(int port, File baseDir, int httpPort, int ajpPort) {
    ContextResource memoryDatabase = new ContextResource();
    memoryDatabase.setName("name");
    memoryDatabase.setDescription("desc");

    TomcatServerBuilder serverBuilder = newServer(port);
    if (baseDir != null) {
        serverBuilder.setCatalinaBase(baseDir);
        serverBuilder.setCatalinaHome(baseDir);
    }

    Map<String, String> connConfig = new HashMap<>();
    connConfig.put(Constants.EXECUTOR_NAME_ATTR, DEFAULT_EXECUTOR_NAME);

    return serverBuilder.enableNaming()
                // .addLifecycleListener(SecurityListener.class)
                .addLifecycleListener(AprLifecycleListener.class)
                .addLifecycleListener(JreMemoryLeakPreventionListener.class)
                .addLifecycleListener(GlobalResourcesLifecycleListener.class)
                .addLifecycleListener(ThreadLocalLeakPreventionListener.class)
                .addGlobalResource(memoryDatabase)
            .addService(DEFAULT_SERVICE_NAME)
            // TODO .withDefaultRealm()
            .setBackgroundProcessorDelay(0)
            .setStartStopThreads(0)
            .addExecutor(DEFAULT_EXECUTOR_NAME, "tomcat-exec-", DEFAULT_EXECUTOR_MIN, DEFAULT_EXECUTOR_MAX, EMPTY_MAP)
            .addConnector(Tomcat.PROTOCOL_BIO, httpPort, connConfig)
            .addConnector(Tomcat.PROTOCOL_AJP, ajpPort, connConfig)
            .addHost(LOCALHOST, "webapps");
}
项目:oryx    文件:Runner.java   
private static void configureServer(Server server) {
  LifecycleListener jasperListener = new JasperListener();
  server.addLifecycleListener(jasperListener);
  jasperListener.lifecycleEvent(new LifecycleEvent(server, Lifecycle.BEFORE_INIT_EVENT, null));
  server.addLifecycleListener(new JreMemoryLeakPreventionListener());
  server.addLifecycleListener(new ThreadLocalLeakPreventionListener());
}
项目:oryx    文件:Runner.java   
private static void configureServer(Server server) {
  LifecycleListener jasperListener = new JasperListener();
  server.addLifecycleListener(jasperListener);
  jasperListener.lifecycleEvent(new LifecycleEvent(server, Lifecycle.BEFORE_INIT_EVENT, null));
  server.addLifecycleListener(new JreMemoryLeakPreventionListener());
  server.addLifecycleListener(new ThreadLocalLeakPreventionListener());
}
项目:myrrix-recommender    文件:Runner.java   
private static void configureServer(Server server) {
  //server.addLifecycleListener(new SecurityListener());
  //server.addLifecycleListener(new AprLifecycleListener());
  LifecycleListener jasperListener = new JasperListener();
  server.addLifecycleListener(jasperListener);
  jasperListener.lifecycleEvent(new LifecycleEvent(server, Lifecycle.BEFORE_INIT_EVENT, null));
  server.addLifecycleListener(new JreMemoryLeakPreventionListener());
  //server.addLifecycleListener(new GlobalResourcesLifecycleListener());
  server.addLifecycleListener(new ThreadLocalLeakPreventionListener());
}
项目:oryx2    文件:ServingLayer.java   
private static void configureServer(Server server) {
  server.addLifecycleListener(new JreMemoryLeakPreventionListener());
  server.addLifecycleListener(new ThreadLocalLeakPreventionListener());
}