Class MonitoringContainerListener
- java.lang.Object
-
- org.glassfish.jersey.server.internal.monitoring.MonitoringContainerListener
-
- All Implemented Interfaces:
ContainerLifecycleListener
public final class MonitoringContainerListener extends java.lang.Object implements ContainerLifecycleListener
Container listener that listens to container events and trigger theapplication events
and call them on suppliedRequestEventListener
. This listener must be registered as a standard provider in Jersey runtime.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MonitoringContainerListener.Binder
A binder that binds theMonitoringContainerListener
.
-
Field Summary
Fields Modifier and Type Field Description private ApplicationEvent
initFinishedEvent
private ApplicationEventListener
listener
-
Constructor Summary
Constructors Constructor Description MonitoringContainerListener()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private ApplicationEvent
getApplicationEvent(ApplicationEvent.Type type)
void
init(ApplicationEventListener listener, ApplicationEvent initFinishedEvent)
Initializes the instance with listener that must be called and initialization event.void
onReload(Container container)
Invoked when thecontainer
has been reloaded.void
onShutdown(Container container)
Invoke at thecontainer
shut-down.void
onStartup(Container container)
Invoked at thecontainer
start-up.
-
-
-
Field Detail
-
initFinishedEvent
private volatile ApplicationEvent initFinishedEvent
-
listener
private volatile ApplicationEventListener listener
-
-
Method Detail
-
init
public void init(ApplicationEventListener listener, ApplicationEvent initFinishedEvent)
Initializes the instance with listener that must be called and initialization event. If this method is not called then events cannot not be triggered which might be needed when noApplicationEventListener
is registered in Jersey runtime.- Parameters:
listener
- Listener that should be called.initFinishedEvent
- Event of typeApplicationEvent.Type.INITIALIZATION_START
.
-
onStartup
public void onStartup(Container container)
Description copied from interface:ContainerLifecycleListener
Invoked at thecontainer
start-up. This method is invoked even when application is reloaded and new instance of application has started.- Specified by:
onStartup
in interfaceContainerLifecycleListener
- Parameters:
container
- container that has been started.
-
onReload
public void onReload(Container container)
Description copied from interface:ContainerLifecycleListener
Invoked when thecontainer
has been reloaded.- Specified by:
onReload
in interfaceContainerLifecycleListener
- Parameters:
container
- container that has been reloaded.
-
getApplicationEvent
private ApplicationEvent getApplicationEvent(ApplicationEvent.Type type)
-
onShutdown
public void onShutdown(Container container)
Description copied from interface:ContainerLifecycleListener
Invoke at thecontainer
shut-down. This method is invoked even before the application is being stopped as a part of reload.- Specified by:
onShutdown
in interfaceContainerLifecycleListener
- Parameters:
container
- container that has been shut down.
-
-