org.glassfish.jersey.server.internal.monitoring
Class MonitoringEventListener

java.lang.Object
  extended by org.glassfish.jersey.server.internal.monitoring.MonitoringEventListener
All Implemented Interfaces:
ApplicationEventListener

public class MonitoringEventListener
extends 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.

Author:
Miroslav Fuksa (miroslav.fuksa at oracle.com)
See Also:
MonitoringStatisticsProcessor

Constructor Summary
MonitoringEventListener()
           
 
Method Summary
 Queue<ApplicationEvent> getApplicationEvents()
          Get the queue of application events.
 void onEvent(ApplicationEvent event)
          Process the application event.
 org.glassfish.jersey.server.internal.monitoring.MonitoringEventListener.ReqEventListener onRequest(RequestEvent requestEvent)
          Process a new request and return a request event listener if listening to request events is required.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MonitoringEventListener

public MonitoringEventListener()
Method Detail

onRequest

public org.glassfish.jersey.server.internal.monitoring.MonitoringEventListener.ReqEventListener onRequest(RequestEvent requestEvent)
Description copied from interface: ApplicationEventListener
Process a new request and return a 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).

Specified by:
onRequest in interface ApplicationEventListener
Parameters:
requestEvent - Event of type RequestEvent.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 application event. This method is called when new event occurs.

Specified by:
onEvent in interface ApplicationEventListener
Parameters:
event - Application event.

getApplicationEvents

public Queue<ApplicationEvent> getApplicationEvents()
Get the queue of application events.

Returns:
Application event queue.


Copyright © 2007-2013, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.