Package org.apache.catalina.core
Class FrameworkListener
- java.lang.Object
-
- org.apache.catalina.core.FrameworkListener
-
- All Implemented Interfaces:
ContainerListener,LifecycleListener
- Direct Known Subclasses:
ThreadLocalLeakPreventionListener
public abstract class FrameworkListener extends java.lang.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
Fields Modifier and Type Field Description protected java.util.concurrent.ConcurrentHashMap<Context,LifecycleListener>contextListenersMap of context to their associated lifecycle listeners.
-
Constructor Summary
Constructors Constructor Description FrameworkListener()Creates a new FrameworkListener instance.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidcontainerEvent(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 voidprocessContainerAddChild(Container child)Processes the addition of a child container by registering appropriate listeners.protected voidprocessContainerRemoveChild(Container child)Processes 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 Detail
-
contextListeners
protected final java.util.concurrent.ConcurrentHashMap<Context,LifecycleListener> contextListeners
Map of context to their associated lifecycle listeners.
-
-
Method Detail
-
createLifecycleListener
protected abstract LifecycleListener createLifecycleListener(Context context)
Create a lifecycle listener which will then be added to the specified context.- Parameters:
context- the associated Context- Returns:
- the lifecycle listener
-
lifecycleEvent
public void lifecycleEvent(LifecycleEvent event)
Description copied from interface:LifecycleListenerAcknowledge the occurrence of the specified event.- Specified by:
lifecycleEventin interfaceLifecycleListener- Parameters:
event- LifecycleEvent that has occurred
-
containerEvent
public void containerEvent(ContainerEvent event)
Description copied from interface:ContainerListenerAcknowledge the occurrence of the specified event.- Specified by:
containerEventin interfaceContainerListener- Parameters:
event- ContainerEvent that has occurred
-
registerListenersForServer
protected void registerListenersForServer(Server server)
Registers listeners on all engines of the given server.- Parameters:
server- The server to register listeners for
-
registerListenersForEngine
protected void registerListenersForEngine(Engine engine)
Registers listeners on all hosts of the given engine.- Parameters:
engine- The engine to register listeners for
-
registerListenersForHost
protected void registerListenersForHost(Host host)
Registers listeners on all contexts of the given host.- Parameters:
host- The host to register listeners for
-
registerContextListener
protected void registerContextListener(Context context)
Creates and registers a lifecycle listener for the given context.- Parameters:
context- The context to register a listener for
-
processContainerAddChild
protected void processContainerAddChild(Container child)
Processes the addition of a child container by registering appropriate listeners.- Parameters:
child- The child container that was added
-
processContainerRemoveChild
protected void processContainerRemoveChild(Container child)
Processes the removal of a child container by unregistering appropriate listeners.- Parameters:
child- The child container that was removed
-
-