Class MBeanListener<T extends MBeanListener.Callback>

java.lang.Object
org.glassfish.external.amx.MBeanListener<T>
All Implemented Interfaces:
EventListener, NotificationListener

@Taxonomy(stability=UNCOMMITTED) public class MBeanListener<T extends MBeanListener.Callback> extends Object implements NotificationListener
Listens for registration of MBeans of various types. Intended usage is for subsystems to lazy-load only when the Parent MBean is registered.
  • Field Details

    • mJMXDomain

      private final String mJMXDomain
      listen for MBeans in a given domain of a given type[name] OR an ObjectName (below)
    • mType

      private final String mType
    • mName

      private final String mName
    • mObjectName

      private final ObjectName mObjectName
      mType and mName should be null if mObjectName is non-null, and vice versa
    • mMBeanServer

      private final MBeanServerConnection mMBeanServer
    • mCallback

      private final T extends MBeanListener.Callback mCallback
  • Constructor Details

    • MBeanListener

      public MBeanListener(MBeanServerConnection server, ObjectName objectName, T callback)
      Listener for a specific MBean. Caller must call startListening() to start listening.
      Parameters:
      server -
      objectName -
      callback -
    • MBeanListener

      public MBeanListener(MBeanServerConnection server, String domain, String type, T callback)
      Listener for all MBeans of specified type, with or without a name. Caller must call startListening() to start listening.
      Parameters:
      server -
      type - type of the MBean (as found in the ObjectName)
      callback -
    • MBeanListener

      public MBeanListener(MBeanServerConnection server, String domain, String type, String name, T callback)
      Listener for MBeans of specified type, with specified name (or any name if null is passed for the name). Caller must call startListening() to start listening.
      Parameters:
      server -
      type - type of the MBean (as found in the ObjectName)
      name - name of the MBean, or null if none
      callback -
  • Method Details

    • debug

      private static void debug(Object o)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getType

      public String getType()
    • getName

      public String getName()
    • getMBeanServer

      public MBeanServerConnection getMBeanServer()
    • getCallback

      public T getCallback()
    • isRegistered

      private boolean isRegistered(MBeanServerConnection conn, ObjectName objectName)
    • startListening

      public void startListening()
      Start listening. If the required MBean(s) are already present, the callback will be synchronously made before returning. It is also possible that the callback could happen twice for the same MBean.
    • stopListening

      public void stopListening()
      unregister the listener
    • handleNotification

      public void handleNotification(Notification notifIn, Object handback)
      Specified by:
      handleNotification in interface NotificationListener