Java Reference
In-Depth Information
The registerMBean() method returns an instance of the ObjectInstance class.
An ObjectInstance object contains the ObjectName of an MBean and its class-
name. This method can throw the following exceptions (all contained in the
javax.management package):
InstanceAlreadyExistsException —An MBean with the given ObjectName
value already exists in the MBean server.
MBeanRegistrationException —The MBean being registered implements
the MBeanRegistration interface and threw an exception in one of the reg-
istration methods.
NotCompliantMBeanException —The object is not a compliant JMX MBean.
See chapters 4 and 5 for the rules governing a compliant MBean.
RuntimeOperationsException —This exception class wraps an IllegalArgu-
mentException indicating that the Object parameter is null or that the
object name is invalid or also null .
The isRegistered() method
If you need to know whether a particular MBean is registered, you can use the
isRegistered() method. You would use this method to check to see if a particu-
lar MBean has already been created, or to determine whether a particular
ObjectName value is already in use.
This method returns a boolean value indicating whether the supplied Object-
Name instance corresponds to one of the registered MBeans in the MBean server.
This method can throw a RuntimeOperationsException indicating that the
ObjectName value supplied is invalid or null .
The unregisterMBean() method
When you need to remove an MBean from the MBean server, you can use the
unregisterMBean() method. This method will unregister (remove) the MBean
that corresponds to the supplied ObjectName instance. An InstanceNotFoundEx-
ception will be thrown if the ObjectName instance does not correspond to a regis-
tered MBean. The following exceptions could arise from this method:
InstanceNotFoundException —The requested MBean cannot be found in
the MBean server.
MBeanRegistrationException —The MBean being registered implements
the MBeanRegistration interface and threw an exception in one of the
deregistration methods.
Search WWH ::




Custom Search