public class ThreadLocalLeakPreventionListener extends FrameworkListener
A LifecycleListener
that triggers the renewal of threads in Executor
pools when a Context
is being stopped to avoid thread-local related
memory leaks.
Note : active threads will be renewed one by one when they come back to the
pool after executing their task, see
ThreadPoolExecutor
.afterExecute().
Modifier and Type | Field and Description |
---|---|
protected static StringManager |
sm
The string manager for this package.
|
contextListeners
Constructor and Description |
---|
ThreadLocalLeakPreventionListener() |
Modifier and Type | Method and Description |
---|---|
void |
containerEvent(ContainerEvent event)
Acknowledge the occurrence of the specified event.
|
protected LifecycleListener |
createLifecycleListener(Context context)
Create a lifecycle listener which will then be added to the specified context.
|
void |
lifecycleEvent(LifecycleEvent event)
Listens for
LifecycleEvent for the start of the Server to
initialize itself and then for after_stop events of each Context . |
processContainerAddChild, processContainerRemoveChild, registerContextListener, registerListenersForEngine, registerListenersForHost, registerListenersForServer
protected static final StringManager sm
public void lifecycleEvent(LifecycleEvent event)
LifecycleEvent
for the start of the Server
to
initialize itself and then for after_stop events of each Context
.lifecycleEvent
in interface LifecycleListener
lifecycleEvent
in class FrameworkListener
event
- LifecycleEvent that has occurredpublic void containerEvent(ContainerEvent event)
ContainerListener
containerEvent
in interface ContainerListener
containerEvent
in class FrameworkListener
event
- ContainerEvent that has occurredprotected LifecycleListener createLifecycleListener(Context context)
FrameworkListener
createLifecycleListener
in class FrameworkListener
context
- the associated ContextCopyright © 2000-2020 Apache Software Foundation. All Rights Reserved.