Package org.glassfish.gmbal.impl
Class JMXRegistrationManager
java.lang.Object
org.glassfish.gmbal.impl.JMXRegistrationManager
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 -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final LinkedHashSet
<MBeanImpl> (package private) boolean
(package private) final Object
private final ManagedObjectManagerInternal
(package private) MBeanImpl
private final ObjectName
private org.glassfish.external.amx.MBeanListener
private int
-
Constructor Summary
ConstructorsConstructorDescriptionJMXRegistrationManager
(ManagedObjectManagerInternal mom, ObjectName rootParentName) -
Method Summary
Modifier and TypeMethodDescription(package private) void
clear()
void
Handle registration of this MBean.void
Decrement the suspended registration count.void
Set the MBeanImpl that is the root of this MBean tree.void
Increment the suspended registration count.void
unregister
(MBeanImpl mb) Unregister the MBean.
-
Field Details
-
suspendCount
private int suspendCount -
mom
-
rootParentName
-
lock
-
deferredRegistrations
-
root
MBeanImpl root -
isJMXRegistrationEnabled
boolean isJMXRegistrationEnabled -
callback
-
rpListener
private org.glassfish.external.amx.MBeanListener rpListener
-
-
Constructor Details
-
JMXRegistrationManager
-
-
Method Details
-
setRoot
public void setRoot(MBeanImpl root) throws InstanceAlreadyExistsException, MBeanRegistrationException, 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:
InstanceAlreadyExistsException
MBeanRegistrationException
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 InstanceAlreadyExistsException, MBeanRegistrationException, 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:
InstanceAlreadyExistsException
MBeanRegistrationException
NotCompliantMBeanException
-
unregister
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:
InstanceNotFoundException
MBeanRegistrationException
-