Java EE 5 SDK

com.sun.appserv.management.util.jmx
Class MBeanRegistrationListener

java.lang.Object
  extended by com.sun.appserv.management.util.jmx.NotificationListenerBase
      extended by com.sun.appserv.management.util.jmx.MBeanRegistrationListener
All Implemented Interfaces:
EventListener, NotificationListener

public abstract class MBeanRegistrationListener
extends NotificationListenerBase

Convenience base class for listening to MBeanServerNotification notifications. A class extending this class must implement mbeanRegistered(javax.management.ObjectName) and mbeanUnregistered(javax.management.ObjectName).

The class is designed to start listening upon creation. The caller should call cleanup() when listening is no longer desired. Once cleanup() is called, no further listening can be done; a new MBeanRegistrationListener should be instantiated if further listening is desired.


Constructor Summary
MBeanRegistrationListener(MBeanServerConnection conn)
          Calls this( conn, null ).
MBeanRegistrationListener(MBeanServerConnection conn, ObjectName constrain)
          If 'constrain' is non-null, then all registration and unregistration events will be filtered through it.
 
Method Summary
 void handleNotification(Notification notifIn, Object handback)
          Subclass should implement this routine.
protected abstract  void mbeanRegistered(ObjectName objectName)
           
protected abstract  void mbeanUnregistered(ObjectName objectName)
           
 
Methods inherited from class com.sun.appserv.management.util.jmx.NotificationListenerBase
checkAlive, cleanup, getConn, getListenees, getMBeanServerConnection, getNotificationFilter, isAlive, listenToIfMatch, listenToMBean
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MBeanRegistrationListener

public MBeanRegistrationListener(MBeanServerConnection conn,
                                 ObjectName constrain)
                          throws InstanceNotFoundException,
                                 IOException
If 'constrain' is non-null, then all registration and unregistration events will be filtered through it. Only those MBeans matching will be passed through to mbeanRegistered(javax.management.ObjectName) and mbeanUnregistered(javax.management.ObjectName).

Parameters:
conn -
constrain - optional fixed or pattern ObjectName
Throws:
InstanceNotFoundException
IOException

MBeanRegistrationListener

public MBeanRegistrationListener(MBeanServerConnection conn)
                          throws InstanceNotFoundException,
                                 IOException
Calls this( conn, null ).

Parameters:
conn -
Throws:
InstanceNotFoundException
IOException
Method Detail

mbeanRegistered

protected abstract void mbeanRegistered(ObjectName objectName)

mbeanUnregistered

protected abstract void mbeanUnregistered(ObjectName objectName)

handleNotification

public void handleNotification(Notification notifIn,
                               Object handback)
Description copied from class: NotificationListenerBase
Subclass should implement this routine.

Specified by:
handleNotification in interface NotificationListener
Specified by:
handleNotification in class NotificationListenerBase

Java EE 5 SDK

Submit a bug or feature

Copyright 2006 Sun Microsystems, Inc. All rights reserved.