@Priority(value=1100) public final class MonitoringEventListener extends java.lang.Object implements ApplicationEventListener
application event listener
that listens to application
and request
events and supplies data to MonitoringStatisticsProcessor
which
produces monitoring 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.
MonitoringStatisticsProcessor
Modifier and Type | Class and 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.
|
Modifier and Type | Field and Description |
---|---|
private static int |
EVENT_QUEUE_SIZE |
private java.util.Queue<RequestEvent> |
exceptionMapperEvents |
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 |
private org.glassfish.hk2.api.ServiceLocator |
serviceLocator |
Constructor and Description |
---|
MonitoringEventListener() |
Modifier and Type | Method and 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 application
event . |
MonitoringEventListener.ReqEventListener |
onRequest(RequestEvent requestEvent)
Process a new request and return a
request event listener if
listening to request events is required. |
private static final java.util.logging.Logger LOGGER
private static final int EVENT_QUEUE_SIZE
@Inject private org.glassfish.hk2.api.ServiceLocator serviceLocator
private final java.util.Queue<MonitoringEventListener.RequestStats> requestQueuedItems
private final java.util.Queue<java.lang.Integer> responseStatuses
private final java.util.Queue<RequestEvent> exceptionMapperEvents
private volatile MonitoringStatisticsProcessor monitoringStatisticsProcessor
public MonitoringEventListener.ReqEventListener onRequest(RequestEvent requestEvent)
ApplicationEventListener
request event listener
if
listening to request 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 then null
must be returned
from the method (do not return empty mock listener in these
cases as it will have negative performance impact).onRequest
in interface ApplicationEventListener
requestEvent
- Event of type RequestEvent.Type.START
.requestEvent
; null otherwise.public void onEvent(ApplicationEvent event)
ApplicationEventListener
event
. This method is called when new event occurs.onEvent
in interface ApplicationEventListener
event
- Application event.java.util.Queue<RequestEvent> getExceptionMapperEvents()
java.util.Queue<MonitoringEventListener.RequestStats> getRequestQueuedItems()
java.util.Queue<java.lang.Integer> getResponseStatuses()