javax.management
public interface MBeanServerConnection
MBeanServer
interface extends this with
additional methods that apply only to local servers.Modifier and Type | Method and Description |
---|---|
void |
addNotificationListener(ObjectName name,
NotificationListener listener,
NotificationFilter filter,
Object passback)
Registers the supplied listener with the specified management
bean.
|
void |
addNotificationListener(ObjectName name,
ObjectName listener,
NotificationFilter filter,
Object passback)
Registers the supplied listener with the specified management
bean.
|
ObjectInstance |
createMBean(String className,
ObjectName name)
Instantiates a new instance of the specified management bean
using the default constructor and registers it with the server
under the supplied name.
|
ObjectInstance |
createMBean(String className,
ObjectName name,
Object[] params,
String[] sig)
Instantiates a new instance of the specified management bean
using the given constructor and registers it with the server
under the supplied name.
|
ObjectInstance |
createMBean(String className,
ObjectName name,
ObjectName loaderName)
Instantiates a new instance of the specified management bean
using the default constructor and registers it with the server
under the supplied name.
|
ObjectInstance |
createMBean(String className,
ObjectName name,
ObjectName loaderName,
Object[] params,
String[] sig)
Instantiates a new instance of the specified management bean
using the given constructor and registers it with the server
under the supplied name.
|
Object |
getAttribute(ObjectName bean,
String name)
Returns the value of the supplied attribute from the specified
management bean.
|
AttributeList |
getAttributes(ObjectName bean,
String[] names)
Returns the values of the named attributes from the specified
management bean.
|
String |
getDefaultDomain()
Returns the default domain this server applies to beans that have
no specified domain.
|
String[] |
getDomains()
Returns an array containing all the domains used by beans registered
with this server.
|
Integer |
getMBeanCount()
Returns the number of management beans registered with this server.
|
MBeanInfo |
getMBeanInfo(ObjectName name)
Returns information on the given management bean.
|
ObjectInstance |
getObjectInstance(ObjectName name)
Returns the
ObjectInstance created for the specified
management bean on registration. |
Object |
invoke(ObjectName bean,
String name,
Object[] params,
String[] sig)
Invokes the supplied operation on the specified management
bean.
|
boolean |
isInstanceOf(ObjectName name,
String className)
Returns true if the specified management bean is an instance
of the supplied class.
|
boolean |
isRegistered(ObjectName name)
Returns true if the specified management bean is registered with
the server.
|
Set<ObjectInstance> |
queryMBeans(ObjectName name,
QueryExp query)
Returns a set of
ObjectInstance s matching the specified
criteria. |
Set<ObjectName> |
queryNames(ObjectName name,
QueryExp query)
Returns a set of
ObjectName s matching the specified
criteria. |
void |
removeNotificationListener(ObjectName name,
NotificationListener listener)
Removes the specified listener from the list of recipients
of notifications from the supplied bean.
|
void |
removeNotificationListener(ObjectName name,
NotificationListener listener,
NotificationFilter filter,
Object passback)
Removes the specified listener from the list of recipients
of notifications from the supplied bean.
|
void |
removeNotificationListener(ObjectName name,
ObjectName listener)
Removes the specified listener from the list of recipients
of notifications from the supplied bean.
|
void |
removeNotificationListener(ObjectName name,
ObjectName listener,
NotificationFilter filter,
Object passback)
Removes the specified listener from the list of recipients
of notifications from the supplied bean.
|
void |
setAttribute(ObjectName name,
Attribute attribute)
Sets the value of the specified attribute of the supplied
management bean.
|
AttributeList |
setAttributes(ObjectName name,
AttributeList attributes)
Sets the value of each of the specified attributes
of the supplied management bean to that specified by
the
Attribute object. |
void |
unregisterMBean(ObjectName name)
Unregisters the specified management bean.
|
void addNotificationListener(ObjectName name, NotificationListener listener, NotificationFilter filter, Object passback) throws InstanceNotFoundException, IOException
ObjectName
instances. The notification is otherwise unchanged.name
- the name of the management bean with which the listener
should be registered.listener
- the listener which will handle notifications from
the bean.filter
- the filter to apply to incoming notifications, or
null
if no filtering should be applied.passback
- an object to be passed to the listener when a
notification is emitted.InstanceNotFoundException
- if the name of the management bean
could not be resolved.IOException
- if an I/O error occurred in communicating with
the bean server.removeNotificationListener(ObjectName, NotificationListener)
,
removeNotificationListener(ObjectName, NotificationListener,
NotificationFilter, Object)
,
NotificationBroadcaster.addNotificationListener(NotificationListener,
NotificationFilter,
Object)
void addNotificationListener(ObjectName name, ObjectName listener, NotificationFilter filter, Object passback) throws InstanceNotFoundException, RuntimeOperationsException, IOException
Registers the supplied listener with the specified management
bean. Notifications emitted by the management bean are forwarded
to the listener via the server, which will convert any MBean
references in the source to portable ObjectName
instances. The notification is otherwise unchanged.
The listener that receives notifications will be the one that is registered with the given name at the time this method is called. Even if it later unregisters and ceases to use that name, it will still receive notifications.
name
- the name of the management bean with which the listener
should be registered.listener
- the name of the listener which will handle
notifications from the bean.filter
- the filter to apply to incoming notifications, or
null
if no filtering should be applied.passback
- an object to be passed to the listener when a
notification is emitted.InstanceNotFoundException
- if the name of the management bean
could not be resolved.RuntimeOperationsException
- if the bean associated with the given
object name is not a
NotificationListener
. This
exception wraps an
IllegalArgumentException
.IOException
- if an I/O error occurred in communicating with
the bean server.removeNotificationListener(ObjectName, NotificationListener)
,
removeNotificationListener(ObjectName, NotificationListener,
NotificationFilter, Object)
,
NotificationBroadcaster.addNotificationListener(NotificationListener,
NotificationFilter,
Object)
ObjectInstance createMBean(String className, ObjectName name) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, IOException
Instantiates a new instance of the specified management bean
using the default constructor and registers it with the server
under the supplied name. The class is loaded using the
default
loader repository
of the server.
If the name supplied is null
, then the bean is
expected to implement the MBeanRegistration
interface.
The preRegister
method
of this interface will be used to obtain the name in this case.
This method is equivalent to calling
with createMBean(className, name, (Object[]) null,
(String[]) null)
null
parameters
and signature.
className
- the class of the management bean, of which
an instance should be created.name
- the name to register the new bean with.ObjectInstance
containing the ObjectName
and Java class name of the created instance.ReflectionException
- if an exception occurs in creating
an instance of the bean.InstanceAlreadyExistsException
- if a matching instance
already exists.MBeanRegistrationException
- if an exception occurs in
calling the preRegister
method.MBeanException
- if the bean's constructor throws an exception.NotCompliantMBeanException
- if the created bean is not
compliant with the JMX specification.RuntimeOperationsException
- if an IllegalArgumentException
is thrown by the server due to a
null
class name or object
name or if the object name is a pattern.IOException
- if an I/O error occurred in communicating with
the bean server.createMBean(String, ObjectName, Object[], String[])
ObjectInstance createMBean(String className, ObjectName name, Object[] params, String[] sig) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, IOException
Instantiates a new instance of the specified management bean
using the given constructor and registers it with the server
under the supplied name. The class is loaded using the
default
loader repository
of the server.
If the name supplied is null
, then the bean is
expected to implement the MBeanRegistration
interface.
The preRegister
method
of this interface will be used to obtain the name in this case.
className
- the class of the management bean, of which
an instance should be created.name
- the name to register the new bean with.params
- the parameters for the bean's constructor.sig
- the signature of the constructor to use.ObjectInstance
containing the ObjectName
and Java class name of the created instance.ReflectionException
- if an exception occurs in creating
an instance of the bean.InstanceAlreadyExistsException
- if a matching instance
already exists.MBeanRegistrationException
- if an exception occurs in
calling the preRegister
method.MBeanException
- if the bean's constructor throws an exception.NotCompliantMBeanException
- if the created bean is not
compliant with the JMX specification.RuntimeOperationsException
- if an IllegalArgumentException
is thrown by the server due to a
null
class name or object
name or if the object name is a pattern.IOException
- if an I/O error occurred in communicating with
the bean server.ObjectInstance createMBean(String className, ObjectName name, ObjectName loaderName) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, InstanceNotFoundException, IOException
Instantiates a new instance of the specified management bean
using the default constructor and registers it with the server
under the supplied name. The class is loaded using the
given class loader. If this argument is null
,
then the same class loader as was used to load the server
is used.
If the name supplied is null
, then the bean is
expected to implement the MBeanRegistration
interface.
The preRegister
method
of this interface will be used to obtain the name in this case.
This method is equivalent to calling
with createMBean(className, name, loaderName, (Object[]) null,
(String) null)
null
parameters
and signature.
className
- the class of the management bean, of which
an instance should be created.name
- the name to register the new bean with.loaderName
- the name of the class loader.ObjectInstance
containing the ObjectName
and Java class name of the created instance.ReflectionException
- if an exception occurs in creating
an instance of the bean.InstanceAlreadyExistsException
- if a matching instance
already exists.MBeanRegistrationException
- if an exception occurs in
calling the preRegister
method.MBeanException
- if the bean's constructor throws an exception.NotCompliantMBeanException
- if the created bean is not
compliant with the JMX specification.InstanceNotFoundException
- if the specified class loader is not
registered with the server.RuntimeOperationsException
- if an IllegalArgumentException
is thrown by the server due to a
null
class name or object
name or if the object name is a pattern.IOException
- if an I/O error occurred in communicating with
the bean server.createMBean(String, ObjectName, ObjectName, Object[], String[])
ObjectInstance createMBean(String className, ObjectName name, ObjectName loaderName, Object[] params, String[] sig) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, InstanceNotFoundException, IOException
Instantiates a new instance of the specified management bean
using the given constructor and registers it with the server
under the supplied name. The class is loaded using the
given class loader. If this argument is null
,
then the same class loader as was used to load the server
is used.
If the name supplied is null
, then the bean is
expected to implement the MBeanRegistration
interface.
The preRegister
method
of this interface will be used to obtain the name in this case.
className
- the class of the management bean, of which
an instance should be created.name
- the name to register the new bean with.loaderName
- the name of the class loader.params
- the parameters for the bean's constructor.sig
- the signature of the constructor to use.ObjectInstance
containing the ObjectName
and Java class name of the created instance.ReflectionException
- if an exception occurs in creating
an instance of the bean.InstanceAlreadyExistsException
- if a matching instance
already exists.MBeanRegistrationException
- if an exception occurs in
calling the preRegister
method.MBeanException
- if the bean's constructor throws an exception.NotCompliantMBeanException
- if the created bean is not
compliant with the JMX specification.InstanceNotFoundException
- if the specified class loader is not
registered with the server.RuntimeOperationsException
- if an IllegalArgumentException
is thrown by the server due to a
null
class name or object
name or if the object name is a pattern.IOException
- if an I/O error occurred in communicating with
the bean server.Object getAttribute(ObjectName bean, String name) throws MBeanException, AttributeNotFoundException, InstanceNotFoundException, ReflectionException, IOException
bean
- the bean to retrieve the value from.name
- the name of the attribute to retrieve.AttributeNotFoundException
- if the attribute could not be
accessed from the bean.MBeanException
- if the management bean's accessor throws
an exception.InstanceNotFoundException
- if the bean can not be found.ReflectionException
- if an exception was thrown in trying
to invoke the bean's accessor.RuntimeOperationsException
- if an IllegalArgumentException
is thrown by the server due to a
null
bean or attribute
name.IOException
- if an I/O error occurred in communicating with
the bean server.DynamicMBean.getAttribute(String)
AttributeList getAttributes(ObjectName bean, String[] names) throws InstanceNotFoundException, ReflectionException, IOException
bean
- the bean to retrieve the value from.names
- the names of the attributes to retrieve.InstanceNotFoundException
- if the bean can not be found.ReflectionException
- if an exception was thrown in trying
to invoke the bean's accessor.RuntimeOperationsException
- if an IllegalArgumentException
is thrown by the server due to a
null
bean or attribute
name.IOException
- if an I/O error occurred in communicating with
the bean server.DynamicMBean.getAttributes(String[])
String getDefaultDomain() throws IOException
IOException
- if an I/O error occurred in communicating with
the bean server.String[] getDomains() throws IOException
IOException
- if an I/O error occurred in communicating with
the bean server.ObjectName.getDomain()
Integer getMBeanCount() throws IOException
IOException
- if an I/O error occurred in communicating with
the bean server.MBeanInfo getMBeanInfo(ObjectName name) throws InstanceNotFoundException, IntrospectionException, ReflectionException, IOException
name
- the name of the management bean.MBeanInfo
for the bean.IntrospectionException
- if an exception occurs in examining
the bean.InstanceNotFoundException
- if the bean can not be found.ReflectionException
- if an exception occurs when trying
to invoke DynamicMBean.getMBeanInfo()
on the bean.IOException
- if an I/O error occurred in communicating with
the bean server.DynamicMBean.getMBeanInfo()
ObjectInstance getObjectInstance(ObjectName name) throws InstanceNotFoundException, IOException
ObjectInstance
created for the specified
management bean on registration.name
- the name of the bean.ObjectInstance
instance.InstanceNotFoundException
- if the bean can not be found.IOException
- if an I/O error occurred in communicating with
the bean server.createMBean(String, ObjectName)
Object invoke(ObjectName bean, String name, Object[] params, String[] sig) throws InstanceNotFoundException, MBeanException, ReflectionException, IOException
bean
- the management bean whose operation should be invoked.name
- the name of the operation to invoke.params
- the parameters of the operation.sig
- the signature of the operation.InstanceNotFoundException
- if the bean can not be found.MBeanException
- if the method invoked throws an exception.ReflectionException
- if an exception is thrown in invoking the
method.IOException
- if an I/O error occurred in communicating with
the bean server.DynamicMBean.invoke(String, Object[], String[])
boolean isInstanceOf(ObjectName name, String className) throws InstanceNotFoundException, IOException
Returns true if the specified management bean is an instance of the supplied class.
A bean, B, is an instance of a class, C, if either of the following conditions holds:
MBeanInfo
is equal to the supplied
name.name
- the name of the management bean.className
- the name of the class to test if name
is
an instance of.InstanceNotFoundException
- if the bean can not be found.IOException
- if an I/O error occurred in communicating with
the bean server.boolean isRegistered(ObjectName name) throws IOException
name
- the name of the management bean.RuntimeOperationsException
- if an IllegalArgumentException
is thrown by the server due to a
null
bean name.IOException
- if an I/O error occurred in communicating with
the bean server.Set<ObjectInstance> queryMBeans(ObjectName name, QueryExp query) throws IOException
Returns a set of ObjectInstance
s matching the specified
criteria. The full set of beans registered with the server
are passed through two filters:
ObjectName
.
If both the object name and the query expression are null
,
or the object name has no domain and no key properties,
no filtering will be performed and all beans are returned.
name
- an ObjectName
to use as a filter.query
- a query expression to apply to each of the beans that match
the given object name.ObjectInstance
s matching the filtered beans.IOException
- if an I/O error occurred in communicating with
the bean server.Set<ObjectName> queryNames(ObjectName name, QueryExp query) throws IOException
Returns a set of ObjectName
s matching the specified
criteria. The full set of beans registered with the server
are passed through two filters:
ObjectName
.
If both the object name and the query expression are null
,
or the object name has no domain and no key properties,
no filtering will be performed and all beans are returned.
name
- an ObjectName
to use as a filter.query
- a query expression to apply to each of the beans that match
the given object name.ObjectName
s matching the filtered beans.IOException
- if an I/O error occurred in communicating with
the bean server.void removeNotificationListener(ObjectName name, NotificationListener listener) throws InstanceNotFoundException, ListenerNotFoundException, IOException
removeNotificationListener(ObjectName,
NotificationListener,NotificationFilter,Object)
name
- the name of the management bean from which the
listener should be removed.listener
- the listener to remove.InstanceNotFoundException
- if the bean can not be found.ListenerNotFoundException
- if the specified listener
is not registered with the bean.IOException
- if an I/O error occurred in communicating with
the bean server.#addNotificationListener(NotificationListener, NotificationFilter,
java.lang.Object)
,
NotificationBroadcaster.removeNotificationListener(NotificationListener)
void removeNotificationListener(ObjectName name, NotificationListener listener, NotificationFilter filter, Object passback) throws InstanceNotFoundException, ListenerNotFoundException, IOException
null
is used as a valid value for these parameters,
rather than as a way to remove all registration instances for
the specified listener; for this behaviour instead, see
removeNotificationListener(ObjectName, NotificationListener)
.name
- the name of the management bean from which the
listener should be removed.listener
- the listener to remove.filter
- the filter of the listener to remove.passback
- the passback object of the listener to remove.InstanceNotFoundException
- if the bean can not be found.ListenerNotFoundException
- if the specified listener
is not registered with the bean.IOException
- if an I/O error occurred in communicating with
the bean server.addNotificationListener(ObjectName, NotificationListener,
NotificationFilter, Object)
,
NotificationEmitter.removeNotificationListener(NotificationListener,
NotificationFilter,
Object)
void removeNotificationListener(ObjectName name, ObjectName listener) throws InstanceNotFoundException, ListenerNotFoundException, IOException
removeNotificationListener(ObjectName,
ObjectName,NotificationFilter,Object)
name
- the name of the management bean from which the
listener should be removed.listener
- the name of the listener to remove.InstanceNotFoundException
- if a name doesn't match a registered
bean.ListenerNotFoundException
- if the specified listener
is not registered with the bean.IOException
- if an I/O error occurred in communicating with
the bean server.#addNotificationListener(NotificationListener, NotificationFilter,
java.lang.Object)
,
NotificationBroadcaster.removeNotificationListener(NotificationListener)
void removeNotificationListener(ObjectName name, ObjectName listener, NotificationFilter filter, Object passback) throws InstanceNotFoundException, ListenerNotFoundException, IOException
null
is used as a valid value for these parameters,
rather than as a way to remove all registration instances for
the specified listener; for this behaviour instead, see
removeNotificationListener(ObjectName, ObjectName)
.name
- the name of the management bean from which the
listener should be removed.listener
- the name of the listener to remove.filter
- the filter of the listener to remove.passback
- the passback object of the listener to remove.InstanceNotFoundException
- if a name doesn't match a registered
bean.ListenerNotFoundException
- if the specified listener
is not registered with the bean.IOException
- if an I/O error occurred in communicating with
the bean server.addNotificationListener(ObjectName, NotificationListener,
NotificationFilter, Object)
,
NotificationEmitter.removeNotificationListener(NotificationListener,
NotificationFilter,
Object)
void setAttribute(ObjectName name, Attribute attribute) throws InstanceNotFoundException, AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException, IOException
name
- the name of the management bean.attribute
- the attribute to set.InstanceNotFoundException
- if the bean can not be found.AttributeNotFoundException
- if the attribute does not
correspond to an attribute
of the bean.InvalidAttributeValueException
- if the value is invalid
for this particular
attribute of the bean.MBeanException
- if setting the attribute causes
the bean to throw an exception (which
becomes the cause of this exception).ReflectionException
- if an exception occurred in trying
to use the reflection interface
to lookup the attribute. The
thrown exception is the cause of
this exception.RuntimeOperationsException
- if an IllegalArgumentException
is thrown by the server due to a
null
bean or attribute
name.IOException
- if an I/O error occurred in communicating with
the bean server.getAttribute(ObjectName, String)
,
DynamicMBean.setAttribute(Attribute)
AttributeList setAttributes(ObjectName name, AttributeList attributes) throws InstanceNotFoundException, ReflectionException, IOException
Attribute
object. The returned list contains
the attributes that were set and their new values.name
- the name of the management bean.attributes
- the attributes to set.InstanceNotFoundException
- if the bean can not be found.ReflectionException
- if an exception occurred in trying
to use the reflection interface
to lookup the attribute. The
thrown exception is the cause of
this exception.RuntimeOperationsException
- if an IllegalArgumentException
is thrown by the server due to a
null
bean or attribute
list.IOException
- if an I/O error occurred in communicating with
the bean server.getAttributes(ObjectName, String[])
,
DynamicMBean.setAttributes(AttributeList)
void unregisterMBean(ObjectName name) throws InstanceNotFoundException, MBeanRegistrationException, IOException
MBeanRegistration.preDeregister()
method will be called if
the bean implements the MBeanRegistration
interface.name
- the name of the management bean.InstanceNotFoundException
- if the bean can not be found.MBeanRegistrationException
- if an exception occurs in
calling the preDeregister
method.RuntimeOperationsException
- if an IllegalArgumentException
is thrown by the server due to a
null
bean name or a
request being made to unregister the
MBeanServerDelegate
bean.IOException
- if an I/O error occurred in communicating with
the bean server.