Package org.glassfish.gmbal.impl
Class JMXRegistrationManager
- java.lang.Object
-
- 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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
JMXRegistrationManager.RootParentListener
-
Field Summary
Fields Modifier and Type Field Description private JMXRegistrationManager.RootParentListener
callback
private java.util.LinkedHashSet<MBeanImpl>
deferredRegistrations
(package private) boolean
isJMXRegistrationEnabled
(package private) java.lang.Object
lock
private ManagedObjectManagerInternal
mom
(package private) MBeanImpl
root
private javax.management.ObjectName
rootParentName
private org.glassfish.external.amx.MBeanListener
rpListener
private int
suspendCount
-
Constructor Summary
Constructors Constructor Description JMXRegistrationManager(ManagedObjectManagerInternal mom, javax.management.ObjectName rootParentName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
clear()
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.
-
-
-
Field Detail
-
suspendCount
private int suspendCount
-
mom
private final ManagedObjectManagerInternal mom
-
rootParentName
private final javax.management.ObjectName rootParentName
-
lock
final java.lang.Object lock
-
deferredRegistrations
private final java.util.LinkedHashSet<MBeanImpl> deferredRegistrations
-
root
MBeanImpl root
-
isJMXRegistrationEnabled
boolean isJMXRegistrationEnabled
-
callback
private JMXRegistrationManager.RootParentListener callback
-
rpListener
private org.glassfish.external.amx.MBeanListener rpListener
-
-
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
-
clear
void clear()
-
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
-
-