Class MonitoringEventListener
- java.lang.Object
-
- org.glassfish.jersey.server.internal.monitoring.MonitoringEventListener
-
- All Implemented Interfaces:
ApplicationEventListener
@Priority(1100) public final class MonitoringEventListener extends java.lang.Object implements ApplicationEventListener
application event listener
that listens toapplication
andrequest
events and supplies data toMonitoringStatisticsProcessor
which producesmonitoring statistics
.The
MonitoringStatisticsProcessor
is started by this class after the first application event comes.This event listener must be registered as a standard provider when monitoring statistics are required in the runtime.
- See Also:
MonitoringStatisticsProcessor
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
MonitoringEventListener.MethodStats
Method statistics.private class
MonitoringEventListener.ReqEventListener
(package private) static class
MonitoringEventListener.RequestStats
Request statistics.(package private) static class
MonitoringEventListener.TimeStats
Time statistics.
-
Field Summary
Fields Modifier and Type Field Description private static int
EVENT_QUEUE_SIZE
private java.util.Queue<RequestEvent>
exceptionMapperEvents
private InjectionManager
injectionManager
private static java.util.logging.Logger
LOGGER
private MonitoringStatisticsProcessor
monitoringStatisticsProcessor
private java.util.Queue<MonitoringEventListener.RequestStats>
requestQueuedItems
private java.util.Queue<java.lang.Integer>
responseStatuses
-
Constructor Summary
Constructors Constructor Description MonitoringEventListener()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) java.util.Queue<RequestEvent>
getExceptionMapperEvents()
Get the exception mapper event queue.(package private) java.util.Queue<MonitoringEventListener.RequestStats>
getRequestQueuedItems()
Get the request event queue.(package private) java.util.Queue<java.lang.Integer>
getResponseStatuses()
Get the queue with response status codes.void
onEvent(ApplicationEvent event)
Process the applicationevent
.MonitoringEventListener.ReqEventListener
onRequest(RequestEvent requestEvent)
Process a new request and return arequest event listener
if listening torequest events
is required.
-
-
-
Field Detail
-
LOGGER
private static final java.util.logging.Logger LOGGER
-
EVENT_QUEUE_SIZE
private static final int EVENT_QUEUE_SIZE
- See Also:
- Constant Field Values
-
injectionManager
@Inject private InjectionManager injectionManager
-
requestQueuedItems
private final java.util.Queue<MonitoringEventListener.RequestStats> requestQueuedItems
-
responseStatuses
private final java.util.Queue<java.lang.Integer> responseStatuses
-
exceptionMapperEvents
private final java.util.Queue<RequestEvent> exceptionMapperEvents
-
monitoringStatisticsProcessor
private volatile MonitoringStatisticsProcessor monitoringStatisticsProcessor
-
-
Method Detail
-
onRequest
public MonitoringEventListener.ReqEventListener onRequest(RequestEvent requestEvent)
Description copied from interface:ApplicationEventListener
Process a new request and return arequest event listener
if listening torequest events
is required. The method is called once for each new incoming request. If listening to the request is required then request event must be returned from the method. Such a request event listener will receive all request events that one request. If listening to request event for the request is not required thennull
must be returned from the method (do not return empty mock listener in these cases as it will have negative performance impact).- Specified by:
onRequest
in interfaceApplicationEventListener
- Parameters:
requestEvent
- Event of typeRequestEvent.Type.START
.- Returns:
- Request event listener that will monitor the events of the request
connected with
requestEvent
; null otherwise.
-
onEvent
public void onEvent(ApplicationEvent event)
Description copied from interface:ApplicationEventListener
Process the applicationevent
. This method is called when new event occurs.- Specified by:
onEvent
in interfaceApplicationEventListener
- Parameters:
event
- Application event.
-
getExceptionMapperEvents
java.util.Queue<RequestEvent> getExceptionMapperEvents()
Get the exception mapper event queue.- Returns:
- Exception mapper event queue.
-
getRequestQueuedItems
java.util.Queue<MonitoringEventListener.RequestStats> getRequestQueuedItems()
Get the request event queue.- Returns:
- Request event queue.
-
getResponseStatuses
java.util.Queue<java.lang.Integer> getResponseStatuses()
Get the queue with response status codes.- Returns:
- response status queue.
-
-