Interface MBeanServerConnection
- All Known Subinterfaces:
MBeanServer
,MBeanServerForwarder
MBeanServer
interface, representing a
local MBean server, extends this interface.- Since:
- 1.5
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addNotificationListener
(ObjectName name, NotificationListener listener, NotificationFilter filter, Object handback) Adds a listener to a registered MBean.void
addNotificationListener
(ObjectName name, ObjectName listener, NotificationFilter filter, Object handback) Adds a listener to a registered MBean.createMBean
(String className, ObjectName name) Instantiates and registers an MBean in the MBean server.createMBean
(String className, ObjectName name, Object[] params, String[] signature) Instantiates and registers an MBean in the MBean server.createMBean
(String className, ObjectName name, ObjectName loaderName) Instantiates and registers an MBean in the MBean server.createMBean
(String className, ObjectName name, ObjectName loaderName, Object[] params, String[] signature) Instantiates and registers an MBean in the MBean server.getAttribute
(ObjectName name, String attribute) Gets the value of a specific attribute of a named MBean.getAttributes
(ObjectName name, String[] attributes) Retrieves the values of several attributes of a named MBean.Returns the default domain used for naming the MBean.String[]
Returns the list of domains in which any MBean is currently registered.Returns the number of MBeans registered in the MBean server.getMBeanInfo
(ObjectName name) This method discovers the attributes and operations that an MBean exposes for management.getObjectInstance
(ObjectName name) Gets theObjectInstance
for a given MBean registered with the MBean server.invoke
(ObjectName name, String operationName, Object[] params, String[] signature) Invokes an operation on an MBean.boolean
isInstanceOf
(ObjectName name, String className) Returns true if the MBean specified is an instance of the specified class, false otherwise.boolean
isRegistered
(ObjectName name) Checks whether an MBean, identified by its object name, is already registered with the MBean server.queryMBeans
(ObjectName name, QueryExp query) Gets MBeans controlled by the MBean server.queryNames
(ObjectName name, QueryExp query) Gets the names of MBeans controlled by the MBean server.void
removeNotificationListener
(ObjectName name, NotificationListener listener) Removes a listener from a registered MBean.void
removeNotificationListener
(ObjectName name, NotificationListener listener, NotificationFilter filter, Object handback) Removes a listener from a registered MBean.void
removeNotificationListener
(ObjectName name, ObjectName listener) Removes a listener from a registered MBean.void
removeNotificationListener
(ObjectName name, ObjectName listener, NotificationFilter filter, Object handback) Removes a listener from a registered MBean.void
setAttribute
(ObjectName name, Attribute attribute) Sets the value of a specific attribute of a named MBean.setAttributes
(ObjectName name, AttributeList attributes) Sets the values of several attributes of a named MBean.void
unregisterMBean
(ObjectName name) Unregisters an MBean from the MBean server.
-
Method Details
-
createMBean
ObjectInstance createMBean(String className, ObjectName name) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, IOException Instantiates and registers an MBean in the MBean server. The MBean server will use its
Default Loader Repository
to load the class of the MBean. An object name is associated with the MBean. If the object name given is null, the MBean must provide its own name by implementing theMBeanRegistration
interface and returning the name from thepreRegister
method.This method is equivalent to
createMBean(className, name, (Object[]) null, (String[]) null)
.- Parameters:
className
- The class name of the MBean to be instantiated.name
- The object name of the MBean. May be null.- Returns:
- An
ObjectInstance
, containing theObjectName
and the Java class name of the newly instantiated MBean. If the containedObjectName
isn
, the contained Java class name is
.getMBeanInfo(n)
.getClassName() - Throws:
ReflectionException
- Wraps ajava.lang.ClassNotFoundException
or ajava.lang.Exception
that occurred when trying to invoke the MBean's constructor.InstanceAlreadyExistsException
- The MBean is already under the control of the MBean server.MBeanRegistrationException
- ThepreRegister
(MBeanRegistration
interface) method of the MBean has thrown an exception. The MBean will not be registered.RuntimeMBeanException
- If the MBean's constructor or itspreRegister
orpostRegister
method threw aRuntimeException
. If thepostRegister
(MBeanRegistration
interface) method of the MBean throws aRuntimeException
, thecreateMBean
method will throw aRuntimeMBeanException
, although the MBean creation and registration succeeded. In such a case, the MBean will be actually registered even though thecreateMBean
method threw an exception. Note thatRuntimeMBeanException
can also be thrown bypreRegister
, in which case the MBean will not be registered.RuntimeErrorException
- If thepostRegister
(MBeanRegistration
interface) method of the MBean throws anError
, thecreateMBean
method will throw aRuntimeErrorException
, although the MBean creation and registration succeeded. In such a case, the MBean will be actually registered even though thecreateMBean
method threw an exception. Note thatRuntimeErrorException
can also be thrown bypreRegister
, in which case the MBean will not be registered.MBeanException
- The constructor of the MBean has thrown an exceptionNotCompliantMBeanException
- This class is not a JMX compliant MBeanRuntimeOperationsException
- Wraps ajava.lang.IllegalArgumentException
: The className passed in parameter is null, theObjectName
passed in parameter contains a pattern or noObjectName
is specified for the MBean.IOException
- A communication problem occurred when talking to the MBean server.- See Also:
-
createMBean
ObjectInstance createMBean(String className, ObjectName name, ObjectName loaderName) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, InstanceNotFoundException, IOException Instantiates and registers an MBean in the MBean server. The class loader to be used is identified by its object name. An object name is associated with the MBean. If the object name of the loader is null, the ClassLoader that loaded the MBean server will be used. If the MBean's object name given is null, the MBean must provide its own name by implementing the
MBeanRegistration
interface and returning the name from thepreRegister
method.This method is equivalent to
createMBean(className, name, loaderName, (Object[]) null, (String[]) null)
.- Parameters:
className
- The class name of the MBean to be instantiated.name
- The object name of the MBean. May be null.loaderName
- The object name of the class loader to be used.- Returns:
- An
ObjectInstance
, containing theObjectName
and the Java class name of the newly instantiated MBean. If the containedObjectName
isn
, the contained Java class name is
.getMBeanInfo(n)
.getClassName() - Throws:
ReflectionException
- Wraps ajava.lang.ClassNotFoundException
or ajava.lang.Exception
that occurred when trying to invoke the MBean's constructor.InstanceAlreadyExistsException
- The MBean is already under the control of the MBean server.MBeanRegistrationException
- ThepreRegister
(MBeanRegistration
interface) method of the MBean has thrown an exception. The MBean will not be registered.RuntimeMBeanException
- If the MBean's constructor or itspreRegister
orpostRegister
method threw aRuntimeException
. If thepostRegister
(MBeanRegistration
interface) method of the MBean throws aRuntimeException
, thecreateMBean
method will throw aRuntimeMBeanException
, although the MBean creation and registration succeeded. In such a case, the MBean will be actually registered even though thecreateMBean
method threw an exception. Note thatRuntimeMBeanException
can also be thrown bypreRegister
, in which case the MBean will not be registered.RuntimeErrorException
- If thepostRegister
(MBeanRegistration
interface) method of the MBean throws anError
, thecreateMBean
method will throw aRuntimeErrorException
, although the MBean creation and registration succeeded. In such a case, the MBean will be actually registered even though thecreateMBean
method threw an exception. Note thatRuntimeErrorException
can also be thrown bypreRegister
, in which case the MBean will not be registered.MBeanException
- The constructor of the MBean has thrown an exceptionNotCompliantMBeanException
- This class is not a JMX compliant MBeanInstanceNotFoundException
- The specified class loader is not registered in the MBean server.RuntimeOperationsException
- Wraps ajava.lang.IllegalArgumentException
: The className passed in parameter is null, theObjectName
passed in parameter contains a pattern or noObjectName
is specified for the MBean.IOException
- A communication problem occurred when talking to the MBean server.- See Also:
-
createMBean
ObjectInstance createMBean(String className, ObjectName name, Object[] params, String[] signature) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, IOException Instantiates and registers an MBean in the MBean server. The MBean server will use itsDefault Loader Repository
to load the class of the MBean. An object name is associated with the MBean. If the object name given is null, the MBean must provide its own name by implementing theMBeanRegistration
interface and returning the name from thepreRegister
method.- Parameters:
className
- The class name of the MBean to be instantiated.name
- The object name of the MBean. May be null.params
- An array containing the parameters of the constructor to be invoked.signature
- An array containing the signature of the constructor to be invoked.- Returns:
- An
ObjectInstance
, containing theObjectName
and the Java class name of the newly instantiated MBean. If the containedObjectName
isn
, the contained Java class name is
.getMBeanInfo(n)
.getClassName() - Throws:
ReflectionException
- Wraps ajava.lang.ClassNotFoundException
or ajava.lang.Exception
that occurred when trying to invoke the MBean's constructor.InstanceAlreadyExistsException
- The MBean is already under the control of the MBean server.MBeanRegistrationException
- ThepreRegister
(MBeanRegistration
interface) method of the MBean has thrown an exception. The MBean will not be registered.RuntimeMBeanException
- If the MBean's constructor or itspreRegister
orpostRegister
method threw aRuntimeException
. If thepostRegister
(MBeanRegistration
interface) method of the MBean throws aRuntimeException
, thecreateMBean
method will throw aRuntimeMBeanException
, although the MBean creation and registration succeeded. In such a case, the MBean will be actually registered even though thecreateMBean
method threw an exception. Note thatRuntimeMBeanException
can also be thrown bypreRegister
, in which case the MBean will not be registered.RuntimeErrorException
- If thepostRegister
(MBeanRegistration
interface) method of the MBean throws anError
, thecreateMBean
method will throw aRuntimeErrorException
, although the MBean creation and registration succeeded. In such a case, the MBean will be actually registered even though thecreateMBean
method threw an exception. Note thatRuntimeErrorException
can also be thrown bypreRegister
, in which case the MBean will not be registered.MBeanException
- The constructor of the MBean has thrown an exceptionNotCompliantMBeanException
- This class is not a JMX compliant MBeanRuntimeOperationsException
- Wraps ajava.lang.IllegalArgumentException
: The className passed in parameter is null, theObjectName
passed in parameter contains a pattern or noObjectName
is specified for the MBean.IOException
- A communication problem occurred when talking to the MBean server.- See Also:
-
createMBean
ObjectInstance createMBean(String className, ObjectName name, ObjectName loaderName, Object[] params, String[] signature) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, InstanceNotFoundException, IOException Instantiates and registers an MBean in the MBean server. The class loader to be used is identified by its object name. An object name is associated with the MBean. If the object name of the loader is not specified, the ClassLoader that loaded the MBean server will be used. If the MBean object name given is null, the MBean must provide its own name by implementing the
MBeanRegistration
interface and returning the name from thepreRegister
method.- Parameters:
className
- The class name of the MBean to be instantiated.name
- The object name of the MBean. May be null.loaderName
- The object name of the class loader to be used.params
- An array containing the parameters of the constructor to be invoked.signature
- An array containing the signature of the constructor to be invoked.- Returns:
- An
ObjectInstance
, containing theObjectName
and the Java class name of the newly instantiated MBean. If the containedObjectName
isn
, the contained Java class name is
.getMBeanInfo(n)
.getClassName() - Throws:
ReflectionException
- Wraps ajava.lang.ClassNotFoundException
or ajava.lang.Exception
that occurred when trying to invoke the MBean's constructor.InstanceAlreadyExistsException
- The MBean is already under the control of the MBean server.MBeanRegistrationException
- ThepreRegister
(MBeanRegistration
interface) method of the MBean has thrown an exception. The MBean will not be registered.RuntimeMBeanException
- The MBean's constructor or itspreRegister
orpostRegister
method threw aRuntimeException
. If thepostRegister
(MBeanRegistration
interface) method of the MBean throws aRuntimeException
, thecreateMBean
method will throw aRuntimeMBeanException
, although the MBean creation and registration succeeded. In such a case, the MBean will be actually registered even though thecreateMBean
method threw an exception. Note thatRuntimeMBeanException
can also be thrown bypreRegister
, in which case the MBean will not be registered.RuntimeErrorException
- If thepostRegister
method (MBeanRegistration
interface) method of the MBean throws anError
, thecreateMBean
method will throw aRuntimeErrorException
, although the MBean creation and registration succeeded. In such a case, the MBean will be actually registered even though thecreateMBean
method threw an exception. Note thatRuntimeErrorException
can also be thrown bypreRegister
, in which case the MBean will not be registered.MBeanException
- The constructor of the MBean has thrown an exceptionNotCompliantMBeanException
- This class is not a JMX compliant MBeanInstanceNotFoundException
- The specified class loader is not registered in the MBean server.RuntimeOperationsException
- Wraps ajava.lang.IllegalArgumentException
: The className passed in parameter is null, theObjectName
passed in parameter contains a pattern or noObjectName
is specified for the MBean.IOException
- A communication problem occurred when talking to the MBean server.- See Also:
-
unregisterMBean
void unregisterMBean(ObjectName name) throws InstanceNotFoundException, MBeanRegistrationException, IOException Unregisters an MBean from the MBean server. The MBean is identified by its object name. Once the method has been invoked, the MBean may no longer be accessed by its object name.- Parameters:
name
- The object name of the MBean to be unregistered.- Throws:
InstanceNotFoundException
- The MBean specified is not registered in the MBean server.
-