Class SessionAwareApplicationMonitor

java.lang.Object
org.glassfish.tyrus.ext.monitoring.jmx.SessionAwareApplicationMonitor
All Implemented Interfaces:
org.glassfish.tyrus.core.monitoring.ApplicationEventListener

public final class SessionAwareApplicationMonitor extends Object
Application events listener and statistics collector. The statistics are collected by aggregating statistics from application endpoints and endpoint sessions. The only difference form SessionlessApplicationMonitor is that SessionlessApplicationMonitor does not collect statistics on session level.

It also creates and registers MXBeans that can be used to access these collected statistics. The created MXBeans will allow accessing monitored properties and statistics on application, endpoint and session level.

For monitoring in Grizzly server an instance should be passed to the server in server properties.

     serverProperties.put(ApplicationEventListener.APPLICATION_EVENT_LISTENER, new SessionAwareApplicationMonitor());
 
For use in servlet container the class name should be passed as a context parameter in web.xml.

     <context-param>
         <param-name>org.glassfish.tyrus.core.monitoring.ApplicationEventListener</param-name>
         <param-value>org.glassfish.tyrus.ext.monitoring.jmx.SessionAwareApplicationMonitor</param-value>
     </context-param>
Author:
Petr Janouch
See Also:
  • ApplicationEventListener
  • Constructor Details

    • SessionAwareApplicationMonitor

      public SessionAwareApplicationMonitor()
      Constructor.
  • Method Details

    • onApplicationInitialized

      public void onApplicationInitialized(String applicationName)
      Specified by:
      onApplicationInitialized in interface org.glassfish.tyrus.core.monitoring.ApplicationEventListener
    • onApplicationDestroyed

      public void onApplicationDestroyed()
      Specified by:
      onApplicationDestroyed in interface org.glassfish.tyrus.core.monitoring.ApplicationEventListener
    • onEndpointRegistered

      public org.glassfish.tyrus.core.monitoring.EndpointEventListener onEndpointRegistered(String endpointPath, Class<?> endpointClass)
      Specified by:
      onEndpointRegistered in interface org.glassfish.tyrus.core.monitoring.ApplicationEventListener
    • onEndpointUnregistered

      public void onEndpointUnregistered(String endpointPath)
      Specified by:
      onEndpointUnregistered in interface org.glassfish.tyrus.core.monitoring.ApplicationEventListener
    • onTextMessageSent

      public void onTextMessageSent(long length)
    • onBinaryMessageSent

      public void onBinaryMessageSent(long length)
    • onControlMessageSent

      public void onControlMessageSent(long length)
    • onTextMessageReceived

      public void onTextMessageReceived(long length)
    • onBinaryMessageReceived

      public void onBinaryMessageReceived(long length)
    • onControlMessageReceived

      public void onControlMessageReceived(long length)