APIdia Launch Partner
Top Description Methods
javax.management

public Interface MBeanServer

extends MBeanServerConnection
Known Direct Subinterfaces
javax.management.remote.MBeanServerForwarder, com.sun.jmx.interceptor.MBeanServerInterceptor, com.sun.jmx.mbeanserver.SunJmxMBeanServer
Imports
java.util.Set, java.io.ObjectInputStream, javax.management.loading.ClassLoaderRepository

This is the interface for MBean manipulation on the agent side. It contains the methods necessary for the creation, registration, and deletion of MBeans as well as the access methods for registered MBeans. This is the core component of the JMX infrastructure.

User code does not usually implement this interface. Instead, an object that implements this interface is obtained with one of the methods in the javax.management.MBeanServerFactory class.

Every MBean which is added to the MBean server becomes manageable: its attributes and operations become remotely accessible through the connectors/adaptors connected to that MBean server. A Java object cannot be registered in the MBean server unless it is a JMX compliant MBean.

When an MBean is registered or unregistered in the MBean server a MBeanServerNotification Notification is emitted. To register an object as listener to MBeanServerNotifications you should call the MBean server method addNotificationListener with ObjectName the ObjectName of the MBeanServerDelegate. This ObjectName is:
JMImplementation:type=MBeanServerDelegate.

Methods of MBeanServer and its subclasses may throw SecurityException if the implementation doesn't authorize access to the underlying resource.

Since
1.5

Method Summary

Modifier and TypeMethod and Description
public void
public void
addNotificationListener(ObjectName name, ObjectName listener, NotificationFilter filter, Object handback)

Redeclares javax.management.MBeanServerConnection.addNotificationListener.

Adds a listener to a registered MBean.

public ObjectInstance
createMBean(String className, ObjectName name)

Redeclares javax.management.MBeanServerConnection.createMBean.

Instantiates and registers an MBean in the MBean server.

public ObjectInstance
createMBean(String className, ObjectName name, ObjectName loaderName)

Redeclares javax.management.MBeanServerConnection.createMBean.

Instantiates and registers an MBean in the MBean server.

public ObjectInstance
createMBean(String className, ObjectName name, Object[] params, String[] signature)

Redeclares javax.management.MBeanServerConnection.createMBean.

Instantiates and registers an MBean in the MBean server.

public ObjectInstance
createMBean(String className, ObjectName name, ObjectName loaderName, Object[] params, String[] signature)

Redeclares javax.management.MBeanServerConnection.createMBean.

Instantiates and registers an MBean in the MBean server.

public default ObjectInputStream

Returns:

The de-serialized object stream.
deserialize
(ObjectName
The name of the MBean whose class loader should be used for the de-serialization.
name
,
byte[]
The byte array to be de-sererialized.
data
)
Deprecated since 1.5. Use getClassLoaderFor to obtain the appropriate class loader for deserialization.

De-serializes a byte array in the context of the class loader of an MBean.

public default ObjectInputStream

Returns:

The de-serialized object stream.
deserialize
(String
The name of the class whose class loader should be used for the de-serialization.
className
,
byte[]
The byte array to be de-sererialized.
data
)
Deprecated since 1.5. Use getClassLoaderRepository to obtain the class loader repository and use it to deserialize.

De-serializes a byte array in the context of a given MBean class loader.

public default ObjectInputStream

Returns:

The de-serialized object stream.
deserialize
(String
The name of the class whose class loader should be used for the de-serialization.
className
,
ObjectName
The name of the class loader to be used for loading the specified class. If null, the MBean Server's class loader will be used.
loaderName
,
byte[]
The byte array to be de-sererialized.
data
)
Deprecated since 1.5. Use getClassLoader to obtain the class loader for deserialization.

De-serializes a byte array in the context of a given MBean class loader.

public Object
getAttribute(ObjectName name, String attribute)

Redeclares javax.management.MBeanServerConnection.getAttribute.

Gets the value of a specific attribute of a named MBean.

public AttributeList
getAttributes(ObjectName name, String[] attributes)

Redeclares javax.management.MBeanServerConnection.getAttributes.

Retrieves the values of several attributes of a named MBean.

public ClassLoader

Returns:

The named ClassLoader. If l is the actual ClassLoader with that name, and r is the returned value, then either: What this means is that the ClassLoader may be wrapped in another ClassLoader for security or other reasons.
getClassLoader
(ObjectName
The ObjectName of the ClassLoader. May be null, in which case the MBean server's own ClassLoader is returned.
loaderName
)

Return the named java.lang.ClassLoader.

public ClassLoader

Returns:

The ClassLoader used for that MBean. If l is the MBean's actual ClassLoader, and r is the returned value, then either: What this means is that the ClassLoader may be wrapped in another ClassLoader for security or other reasons.
getClassLoaderFor
(ObjectName
The ObjectName of the MBean.
mbeanName
)

Return the java.lang.ClassLoader that was used for loading the class of the named MBean.

public ClassLoaderRepository

Returns:

The ClassLoaderRepository for this MBeanServer.
getClassLoaderRepository
()

Return the ClassLoaderRepository for this MBeanServer.

public String
getDefaultDomain()

Redeclares javax.management.MBeanServerConnection.getDefaultDomain.

Returns the default domain used for naming the MBean.

public String[]
getDomains()

Redeclares javax.management.MBeanServerConnection.getDomains.

Returns the list of domains in which any MBean is currently registered.

public Integer

Returns:

the number of registered MBeans, wrapped in an Integer. If the caller's permissions are restricted, this number may be greater than the number of MBeans the caller can access.
getMBeanCount
()

Redeclares javax.management.MBeanServerConnection.getMBeanCount.

Returns the number of MBeans registered in the MBean server.

public MBeanInfo
getMBeanInfo(ObjectName name)

Redeclares javax.management.MBeanServerConnection.getMBeanInfo.

This method discovers the attributes and operations that an MBean exposes for management.

public ObjectInstance
getObjectInstance(ObjectName name)

Redeclares javax.management.MBeanServerConnection.getObjectInstance.

Gets the ObjectInstance for a given MBean registered with the MBean server.

public Object

Returns:

The newly instantiated object.
instantiate
(String
The class name of the object to be instantiated.
className
)

Instantiates an object using the list of all class loaders registered in the MBean server's Class Loader Repository.

public Object

Returns:

The newly instantiated object.
instantiate
(String
The class name of the MBean to be instantiated.
className
,
ObjectName
The object name of the class loader to be used.
loaderName
)

Instantiates an object using the class Loader specified by its ObjectName.

public Object

Returns:

The newly instantiated object.
instantiate
(String
The class name of the object to be instantiated.
className
,
Object[]
An array containing the parameters of the constructor to be invoked.
params
,
String[]
An array containing the signature of the constructor to be invoked.
signature
)

Instantiates an object using the list of all class loaders registered in the MBean server Class Loader Repository.

public Object

Returns:

The newly instantiated object.
instantiate
(String
The class name of the object to be instantiated.
className
,
ObjectName
The object name of the class loader to be used.
loaderName
,
Object[]
An array containing the parameters of the constructor to be invoked.
params
,
String[]
An array containing the signature of the constructor to be invoked.
signature
)

Instantiates an object.

public Object
invoke(ObjectName name, String operationName, Object[] params, String[] signature)

Redeclares javax.management.MBeanServerConnection.invoke.

Invokes an operation on an MBean.

public boolean
isInstanceOf(ObjectName name, String className)

Redeclares javax.management.MBeanServerConnection.isInstanceOf.

Returns true if the MBean specified is an instance of the specified class, false otherwise.

public boolean
isRegistered(ObjectName name)

Redeclares javax.management.MBeanServerConnection.isRegistered.

Checks whether an MBean, identified by its object name, is already registered with the MBean server.

public Set<ObjectInstance>
queryMBeans(ObjectName name, QueryExp query)

Redeclares javax.management.MBeanServerConnection.queryMBeans.

Gets MBeans controlled by the MBean server.

public Set<ObjectName>
queryNames(ObjectName name, QueryExp query)

Redeclares javax.management.MBeanServerConnection.queryNames.

Gets the names of MBeans controlled by the MBean server.

public ObjectInstance

Returns:

An ObjectInstance, containing the ObjectName and the Java class name of the newly registered MBean. If the contained ObjectName is n, the contained Java class name is getMBeanInfo(n).getClassName().
registerMBean
(Object
The MBean to be registered as an MBean.
object
,
ObjectName
The object name of the MBean. May be null.
name
)

Registers a pre-existing object as an MBean with the MBean server.

public void
removeNotificationListener(ObjectName name, ObjectName listener)

Redeclares javax.management.MBeanServerConnection.removeNotificationListener.

Removes a listener from a registered MBean.

public void
removeNotificationListener(ObjectName name, ObjectName listener, NotificationFilter filter, Object handback)

Redeclares javax.management.MBeanServerConnection.removeNotificationListener.

Removes a listener from a registered MBean.

public void
public void
public void
setAttribute(ObjectName name, Attribute attribute)

Redeclares javax.management.MBeanServerConnection.setAttribute.

Sets the value of a specific attribute of a named MBean.

public AttributeList
setAttributes(ObjectName name, AttributeList attributes)

Redeclares javax.management.MBeanServerConnection.setAttributes.

Sets the values of several attributes of a named MBean.

public void
unregisterMBean(ObjectName name)

Redeclares javax.management.MBeanServerConnection.unregisterMBean.

Unregisters an MBean from the MBean server.