Package org.glassfish.gmbal.impl
Class JMXRegistrationManager
- java.lang.Object
-
- org.glassfish.gmbal.impl.JMXRegistrationManager
-
public class JMXRegistrationManager extends java.lang.ObjectA 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 classJMXRegistrationManager.RootParentListener
-
Field Summary
Fields Modifier and Type Field Description private JMXRegistrationManager.RootParentListenercallbackprivate java.util.LinkedHashSet<MBeanImpl>deferredRegistrations(package private) booleanisJMXRegistrationEnabled(package private) java.lang.Objectlockprivate ManagedObjectManagerInternalmom(package private) MBeanImplrootprivate javax.management.ObjectNamerootParentNameprivate org.glassfish.external.amx.MBeanListenerrpListenerprivate intsuspendCount
-
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) voidclear()voidregister(MBeanImpl mb)Handle registration of this MBean.voidresumeRegistration()Decrement the suspended registration count.voidsetRoot(MBeanImpl root)Set the MBeanImpl that is the root of this MBean tree.voidsuspendRegistration()Increment the suspended registration count.voidunregister(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.InstanceAlreadyExistsExceptionjavax.management.MBeanRegistrationExceptionjavax.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.InstanceAlreadyExistsExceptionjavax.management.MBeanRegistrationExceptionjavax.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.InstanceNotFoundExceptionjavax.management.MBeanRegistrationException
-
-