org.glassfish.gmbal.impl
Class JMXRegistrationManager

java.lang.Object
  extended by org.glassfish.gmbal.impl.JMXRegistrationManager

public class JMXRegistrationManager
extends java.lang.Object

A simple class that implements deferred registration. When registration is suspended, mbean registrations are queued until registration is resumed, at which time the registration are processed in order.

Author:
ken

Constructor Summary
JMXRegistrationManager(ManagedObjectManagerInternal mom, javax.management.ObjectName rootParentName)
           
 
Method Summary
 void register(MBeanImpl mb)
          Handle registration of this MBean.
 void resumeRegistration()
          Decrement the suspended registration count.
 void setRoot(MBeanImpl root)
          Set the MBeanImpl that is the root of this MBean tree.
 void suspendRegistration()
          Increment the suspended registration count.
 void unregister(MBeanImpl mb)
          Unregister the MBean.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JMXRegistrationManager

public JMXRegistrationManager(ManagedObjectManagerInternal mom,
                              javax.management.ObjectName rootParentName)
Method Detail

setRoot

public void setRoot(MBeanImpl root)
             throws javax.management.InstanceAlreadyExistsException,
                    javax.management.MBeanRegistrationException,
                    javax.management.NotCompliantMBeanException
Set the MBeanImpl that is the root of this MBean tree. Must be set before other methods are called (but this is not enforced).

Parameters:
root - The root of the tree.
Throws:
javax.management.InstanceAlreadyExistsException
javax.management.MBeanRegistrationException
javax.management.NotCompliantMBeanException

suspendRegistration

public void suspendRegistration()
Increment the suspended registration count. All registrations with JMX are suspended while suspendCount > 0.


resumeRegistration

public void resumeRegistration()
Decrement the suspended registration count. If the count goes to zero. all registrations that occurred while suspendCount > 0 are registered with the JMX server, UNLESS isJMXRegistrationEnabled is false, in which case we simply clear the deferredRegistrations list, because all MBean will be registered once the root is available.


register

public void register(MBeanImpl mb)
              throws javax.management.InstanceAlreadyExistsException,
                     javax.management.MBeanRegistrationException,
                     javax.management.NotCompliantMBeanException
Handle registration of this MBean. If we are suspended, simply add to the deferredRegistrationList and mark the MBean as suspended. If we are not suspended, then register if JMX registration is enabled.

Parameters:
mb - The MBeanImpl to register
Throws:
javax.management.InstanceAlreadyExistsException
javax.management.MBeanRegistrationException
javax.management.NotCompliantMBeanException

unregister

public void unregister(MBeanImpl mb)
                throws javax.management.InstanceNotFoundException,
                       javax.management.MBeanRegistrationException
Unregister the MBean. If we are suspended, remove from the deferredRegistrations list and mark suspended false. In any case, we unregister from JMX if JMX registration is enabled. Note that we may call unregister on an unregistered object if suspendCount > 0, but that's OK, because MBean.unregister does nothing if mb is not registered.

Parameters:
mb - The MBean to unregister.
Throws:
javax.management.InstanceNotFoundException
javax.management.MBeanRegistrationException