Class FrameworkListener
java.lang.Object
org.apache.catalina.core.FrameworkListener
- All Implemented Interfaces:
ContainerListener, LifecycleListener
- Direct Known Subclasses:
ThreadLocalLeakPreventionListener
public abstract class FrameworkListener
extends Object
implements LifecycleListener, ContainerListener
This listener must be declared in server.xml as a Server listener, possibly optional. It will register a lifecycle
listener on all contexts. This is an alternative to adding a Listener in context.xml with more flexibility.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ConcurrentHashMap<Context, LifecycleListener> Map of context to their associated lifecycle listeners. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcontainerEvent(ContainerEvent event) Acknowledge the occurrence of the specified event.protected abstract LifecycleListenercreateLifecycleListener(Context context) Create a lifecycle listener which will then be added to the specified context.voidlifecycleEvent(LifecycleEvent event) Acknowledge the occurrence of the specified event.protected voidProcesses the addition of a child container by registering appropriate listeners.protected voidProcesses the removal of a child container by unregistering appropriate listeners.protected voidregisterContextListener(Context context) Creates and registers a lifecycle listener for the given context.protected voidregisterListenersForEngine(Engine engine) Registers listeners on all hosts of the given engine.protected voidregisterListenersForHost(Host host) Registers listeners on all contexts of the given host.protected voidregisterListenersForServer(Server server) Registers listeners on all engines of the given server.
-
Field Details
-
contextListeners
Map of context to their associated lifecycle listeners.
-
-
Constructor Details
-
FrameworkListener
public FrameworkListener()Creates a new FrameworkListener instance.
-
-
Method Details
-
createLifecycleListener
Create a lifecycle listener which will then be added to the specified context.- Parameters:
context- the associated Context- Returns:
- the lifecycle listener
-
lifecycleEvent
Description copied from interface:LifecycleListenerAcknowledge the occurrence of the specified event.- Specified by:
lifecycleEventin interfaceLifecycleListener- Parameters:
event- LifecycleEvent that has occurred
-
containerEvent
Description copied from interface:ContainerListenerAcknowledge the occurrence of the specified event.- Specified by:
containerEventin interfaceContainerListener- Parameters:
event- ContainerEvent that has occurred
-
registerListenersForServer
Registers listeners on all engines of the given server.- Parameters:
server- The server to register listeners for
-
registerListenersForEngine
Registers listeners on all hosts of the given engine.- Parameters:
engine- The engine to register listeners for
-
registerListenersForHost
Registers listeners on all contexts of the given host.- Parameters:
host- The host to register listeners for
-
registerContextListener
Creates and registers a lifecycle listener for the given context.- Parameters:
context- The context to register a listener for
-
processContainerAddChild
Processes the addition of a child container by registering appropriate listeners.- Parameters:
child- The child container that was added
-
processContainerRemoveChild
Processes the removal of a child container by unregistering appropriate listeners.- Parameters:
child- The child container that was removed
-