Class Supervisor

java.lang.Object
javax.management.StandardMBean
org.apache.sis.internal.system.Supervisor
All Implemented Interfaces:
DynamicMBean, MBeanRegistration, SupervisorMBean

public final class Supervisor extends StandardMBean implements SupervisorMBean
A central place where to monitor library-wide information through a MBean. For example we register every WeakHashSet created as static variables. The MBean interface should allow administrators to know the cache size and eventually perform some operations like clearing a cache.
Since:
0.3
Version:
0.7
  • Field Details

    • ENABLED

      static final boolean ENABLED
      Whatever JMX agent is enabled. Setting this variable to false allows the Java compiler to omit any dependency to this Supervisor class.
      See Also:
    • NAME

      public static final String NAME
      The JMX object name for the Supervisor service.
      See Also:
    • name

      private static volatile ObjectName name
      The JMX object name, created when the register() is first invoked. ObjectName.WILDCARD is used as a sentinel value if the registration failed.
  • Constructor Details

  • Method Details

    • register

      @Configuration public static void register()
      Registers the Supervisor instance, if not already done. If the supervisor has already been registered but has not yet been unregistered, then this method does nothing.

      If the registration fails, then this method logs a message at the warning level and the MBean will not be registered. This method does not propagate the exception because the MBean is not a mandatory part of SIS library.

    • unregister

      @Configuration static void unregister() throws JMException
      Unregister the Supervisor instance. This method does nothing if the supervisor has not been previously successfully registered, or if it has already been unregistered.
      Throws:
      JMException - if an error occurred during unregistration.
    • getImpact

      protected int getImpact(MBeanOperationInfo info)
      Returns the operations impact, which is INFO.
      Overrides:
      getImpact in class StandardMBean
      Returns:
      INFO.
    • getDescription

      protected String getDescription(MBeanInfo info)
      Returns the localized description for this MBean.
      Overrides:
      getDescription in class StandardMBean
      Returns:
      a localized description.
    • getDescription

      protected String getDescription(MBeanFeatureInfo info)
      Returns the localized description for the given constructor, attribute or operation.
      Overrides:
      getDescription in class StandardMBean
      Returns:
      a localized description for the given attribute or operation.
    • getDescription

      protected String getDescription(MBeanConstructorInfo info, MBeanParameterInfo param, int sequence)
      Returns the localized description for the given constructor parameter.
      Overrides:
      getDescription in class StandardMBean
      Parameters:
      info - the constructor.
      param - the constructor parameter.
      sequence - the parameter number (0 for the first parameter, 1 for the second, etc.)
      Returns:
      a localized description for the specified constructor parameter.
    • getParameterName

      protected String getParameterName(MBeanConstructorInfo info, MBeanParameterInfo param, int sequence)
      Returns the name of the given constructor parameter.
      Overrides:
      getParameterName in class StandardMBean
      Parameters:
      info - the constructor.
      param - the constructor parameter.
      sequence - the parameter number (0 for the first parameter, 1 for the second, etc.)
      Returns:
      the name of the specified constructor parameter.
    • getDescription

      private String getDescription(String resourceKey)
      Returns the string from the Descriptions resource bundle for the given key.
    • configuration

      public TreeTable configuration(EnumSet<About> sections, Locale locale, TimeZone timezone)
      Returns information about the current configuration. This method tries to focus on the information that are the most relevant to SIS. Those information are grouped in sections: a "Versions" section containing the Apache SIS version, Java version and operation system version; a "Classpath" section containing bootstrap, extension and user classpath, etc.
      Specified by:
      configuration in interface SupervisorMBean
      Parameters:
      sections - the section for which information are desired.
      locale - the locale to use for formatting the texts in the tree, or null for the default.
      timezone - the timezone to use for formatting the dates, or null for the default.
      Returns:
      configuration information, as a tree for grouping some configuration by sections.
    • warnings

      public String[] warnings(Locale locale)
      If there is something wrong with the current Apache SIS status, returns descriptions of the problems. Otherwise returns null.
      Specified by:
      warnings in interface SupervisorMBean
      Parameters:
      locale - the locale to use for reporting messages, or null for the default.
      Returns:
      a description of a problems in the library, or null if none.