Package org.apache.catalina.core
Class ThreadLocalLeakPreventionListener
java.lang.Object
org.apache.catalina.core.FrameworkListener
org.apache.catalina.core.ThreadLocalLeakPreventionListener
- All Implemented Interfaces:
ContainerListener
,LifecycleListener
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().
This listener must only be nested within Server
elements.
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final StringManager
The string manager for this package.Fields inherited from class org.apache.catalina.core.FrameworkListener
contextListeners
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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 forLifecycleEvent
for the start of theServer
to initialize itself and then for after_stop events of eachContext
.Methods inherited from class org.apache.catalina.core.FrameworkListener
processContainerAddChild, processContainerRemoveChild, registerContextListener, registerListenersForEngine, registerListenersForHost, registerListenersForServer
-
Field Details
-
sm
The string manager for this package.
-
-
Constructor Details
-
ThreadLocalLeakPreventionListener
public ThreadLocalLeakPreventionListener()
-
-
Method Details
-
lifecycleEvent
Listens forLifecycleEvent
for the start of theServer
to initialize itself and then for after_stop events of eachContext
.- Specified by:
lifecycleEvent
in interfaceLifecycleListener
- Overrides:
lifecycleEvent
in classFrameworkListener
- Parameters:
event
- LifecycleEvent that has occurred
-
containerEvent
Description copied from interface:ContainerListener
Acknowledge the occurrence of the specified event.- Specified by:
containerEvent
in interfaceContainerListener
- Overrides:
containerEvent
in classFrameworkListener
- Parameters:
event
- ContainerEvent that has occurred
-
createLifecycleListener
Description copied from class:FrameworkListener
Create a lifecycle listener which will then be added to the specified context.- Specified by:
createLifecycleListener
in classFrameworkListener
- Parameters:
context
- the associated Context- Returns:
- the lifecycle listener
-