private static void configureServer(Server server) { server.addLifecycleListener(new JreMemoryLeakPreventionListener()); server.addLifecycleListener(new ThreadLocalLeakPreventionListener()); }
protected void processContainerAddChild(Container parent, Container child) { if (log.isDebugEnabled()) log.debug("Process addChild[parent=" + parent + ",child=" + child + "]"); if (child instanceof Context) { registerContextListener((Context) child); } else if (child instanceof Engine) { registerListenersForEngine((Engine) child); } else if (child instanceof Host) { registerListenersForHost((Host) child); } }
@Override public void containerEvent(ContainerEvent event) { try { String type = event.getType(); if (Container.ADD_CHILD_EVENT.equals(type)) { processContainerAddChild(event.getContainer(), (Container) event.getData()); } else if (Container.REMOVE_CHILD_EVENT.equals(type)) { processContainerRemoveChild(event.getContainer(), (Container) event.getData()); } } catch (Exception e) { String msg = sm.getString( "threadLocalLeakPreventionListener.containerEvent.error", event); log.error(msg, e); } }
/** * Listens for {@link LifecycleEvent} for the start of the {@link Server} to * initialize itself and then for after_stop events of each {@link Context}. */ @Override public void lifecycleEvent(LifecycleEvent event) { try { Lifecycle lifecycle = event.getLifecycle(); if (Lifecycle.AFTER_START_EVENT.equals(event.getType()) && lifecycle instanceof Server) { // when the server starts, we register ourself as listener for // all context // as well as container event listener so that we know when new // Context are deployed Server server = (Server) lifecycle; registerListenersForServer(server); } if (Lifecycle.AFTER_STOP_EVENT.equals(event.getType()) && lifecycle instanceof Context) { stopIdleThreads((Context) lifecycle); } } catch (Exception e) { String msg = sm.getString( "threadLocalLeakPreventionListener.lifecycleEvent.error", event); log.error(msg, e); } }
private void registerListenersForServer(Server server) { for (Service service : server.findServices()) { Engine engine = service.getContainer(); if (engine != null) { engine.addContainerListener(this); registerListenersForEngine(engine); } } }
private void registerListenersForEngine(Engine engine) { for (Container hostContainer : engine.findChildren()) { Host host = (Host) hostContainer; host.addContainerListener(this); registerListenersForHost(host); } }
private void registerListenersForHost(Host host) { for (Container contextContainer : host.findChildren()) { Context context = (Context) contextContainer; registerContextListener(context); } }
protected void processContainerAddChild(Container parent, Container child) { if (log.isDebugEnabled()) log.debug("Process addChild[parent=" + parent + ",child=" + child + "]"); if (child instanceof Context) { registerContextListener((Context) child); } else if (child instanceof Engine) { registerListenersForEngine((Engine) child); } else if (child instanceof Host) { registerListenersForHost((Host) child); } }
@Override public void containerEvent(ContainerEvent event) { try { String type = event.getType(); if (Container.ADD_CHILD_EVENT.equals(type)) { processContainerAddChild(event.getContainer(), (Container) event.getData()); } else if (Container.REMOVE_CHILD_EVENT.equals(type)) { processContainerRemoveChild(event.getContainer(), (Container) event.getData()); } } catch (Exception e) { String msg = sm.getString( "threadLocalLeakPreventionListener.containerEvent.error", event); log.error(msg, e); } }
/** * Listens for {@link LifecycleEvent} for the start of the {@link Server} to * initialize itself and then for after_stop events of each {@link Context}. */ @Override public void lifecycleEvent(LifecycleEvent event) { try { Lifecycle lifecycle = event.getLifecycle(); if (Lifecycle.AFTER_START_EVENT.equals(event.getType()) && lifecycle instanceof Server) { // when the server starts, we register ourself as listener for // all context // as well as container event listener so that we know when new // Context are deployed Server server = (Server) lifecycle; registerListenersForServer(server); } if (Lifecycle.AFTER_STOP_EVENT.equals(event.getType()) && lifecycle instanceof Context) { stopIdleThreads((Context) lifecycle); } } catch (Exception e) { String msg = sm.getString( "threadLocalLeakPreventionListener.lifecycleEvent.error", event); log.error(msg, e); } }
private void registerListenersForServer(Server server) { for (Service service : server.findServices()) { Engine engine = (Engine) service.getContainer(); engine.addContainerListener(this); registerListenersForEngine(engine); } }
private void registerListenersForEngine(Engine engine) { for (Container hostContainer : engine.findChildren()) { Host host = (Host) hostContainer; host.addContainerListener(this); registerListenersForHost(host); } }
private void registerListenersForHost(Host host) { for (Container contextContainer : host.findChildren()) { Context context = (Context) contextContainer; registerContextListener(context); } }
protected void processContainerAddChild(Container parent, Container child) { if (log.isDebugEnabled()) log.debug("Process addChild[parent=" + parent + ",child=" + child + "]"); if (child instanceof Context) { registerContextListener((Context) child); } else if (child instanceof Engine) { registerListenersForEngine((Engine) child); } else if (child instanceof Host) { registerListenersForHost((Host) child); } }
@Override public void containerEvent(ContainerEvent event) { try { String type = event.getType(); if (Container.ADD_CHILD_EVENT.equals(type)) { processContainerAddChild(event.getContainer(), (Container) event.getData()); } else if (Container.REMOVE_CHILD_EVENT.equals(type)) { processContainerRemoveChild(event.getContainer(), (Container) event.getData()); } } catch (Exception e) { String msg = sm.getString( "threadLocalLeakPreventionListener.containerEvent.error", event); log.error(msg, e); } }
/** * Listens for {@link LifecycleEvent} for the start of the {@link Server} to * initialize itself and then for after_stop events of each {@link Context}. */ @Override public void lifecycleEvent(LifecycleEvent event) { try { Lifecycle lifecycle = event.getLifecycle(); if (Lifecycle.AFTER_START_EVENT.equals(event.getType()) && lifecycle instanceof Server) { // when the server starts, we register ourself as listener for // all context // as well as container event listener so that we know when new // Context are deployed Server server = (Server) lifecycle; registerListenersForServer(server); } if (Lifecycle.AFTER_STOP_EVENT.equals(event.getType()) && lifecycle instanceof Context) { stopIdleThreads((Context) lifecycle); } } catch (Exception e) { String msg = sm.getString( "threadLocalLeakPreventionListener.lifecycleEvent.error", event); log.error(msg, e); } }
private void registerListenersForServer(Server server) { for (Service service : server.findServices()) { Engine engine = (Engine) service.getContainer(); engine.addContainerListener(this); registerListenersForEngine(engine); } }
private void registerListenersForEngine(Engine engine) { for (Container hostContainer : engine.findChildren()) { Host host = (Host) hostContainer; host.addContainerListener(this); registerListenersForHost(host); } }
private void registerListenersForHost(Host host) { for (Container contextContainer : host.findChildren()) { Context context = (Context) contextContainer; registerContextListener(context); } }
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()); }