Package org.glassfish.external.amx
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceCallback interface.static classDefault callback implementation, can be subclassed if needed Remembers only the last MBean that was seen. -
Constructor Summary
ConstructorsConstructorDescriptionMBeanListener(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).MBeanListener(MBeanServerConnection server, String domain, String type, T callback) Listener for all MBeans of specified type, with or without a name.MBeanListener(MBeanServerConnection server, ObjectName objectName, T callback) Listener for a specific MBean. -
Method Summary
Modifier and TypeMethodDescriptiongetName()getType()voidhandleNotification(Notification notifIn, Object handback) voidStart listening.voidunregister the listenertoString()
-
Constructor Details
-
MBeanListener
Listener for a specific MBean. Caller must callstartListening()to start listening.- Parameters:
server-objectName-callback-
-
MBeanListener
Listener for all MBeans of specified type, with or without a name. Caller must callstartListening()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 callstartListening()to start listening.- Parameters:
server-type- type of the MBean (as found in the ObjectName)name- name of the MBean, or null if nonecallback-
-
-
Method Details
-
toString
-
getType
-
getName
-
getMBeanServer
-
getCallback
-
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
- Specified by:
handleNotificationin interfaceNotificationListener
-