java.lang.Object
org.glassfish.jersey.server.spi.AbstractContainerLifecycleListener
org.glassfish.jersey.server.internal.monitoring.jmx.MBeanExposer
All Implemented Interfaces:
MonitoringStatisticsListener, ContainerLifecycleListener

public class MBeanExposer extends AbstractContainerLifecycleListener implements MonitoringStatisticsListener
The main exposer class of Jersey JMX MBeans. The class creates MBeans and contains methods that register and unregister MBeans.
  • Field Details

  • Constructor Details

    • MBeanExposer

      public MBeanExposer()
  • Method Details

    • transformToStringKeys

      private Map<String,ResourceStatistics> transformToStringKeys(Map<Class<?>,ResourceStatistics> stats)
    • convertToObjectName

      static String convertToObjectName(String name, boolean isUri)
      Convert the resource name to a valid object name.
      Parameters:
      name - Resource name.
      isUri - true if the resource name is an URI.
      Returns:
      Converted valid object name.
    • registerMBean

      void registerMBean(Object mbean, String namePostfix)
      Register the MBean with the given postfix name.
      Parameters:
      mbean - MBean to be registered.
      namePostfix - Postfix of the object name in the pattern ",[property]=[value]...". Example ",subType=Requests,details=Execution"
    • unregisterJerseyMBeans

      private void unregisterJerseyMBeans(boolean destroy)
    • onStatistics

      public void onStatistics(MonitoringStatistics statistics)
      Description copied from interface: MonitoringStatisticsListener
      The method is called when new statistics are available and statistics are passed as an argument.
      Specified by:
      onStatistics in interface MonitoringStatisticsListener
      Parameters:
      statistics - Newly calculated monitoring statistics.
    • onShutdown

      public void onShutdown(Container container)
      Description copied from interface: ContainerLifecycleListener
      Invoke at the container shut-down. This method is invoked even before the application is being stopped as a part of reload.
      Specified by:
      onShutdown in interface ContainerLifecycleListener
      Overrides:
      onShutdown in class AbstractContainerLifecycleListener
      Parameters:
      container - container that has been shut down.