/** * 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); } }
/** * 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); } }
/** * 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); } }