public abstract class

MBeanSupport

extends Object
implements DynamicMBean2 MBeanRegistration
java.lang.Object
   ↳ com.sun.jmx.mbeanserver.MBeanSupport<M>
Known Direct Subclasses

Class Overview

Base class for MBeans. There is one instance of this class for every Standard MBean and every MXBean. We try to limit the amount of information per instance so we can handle very large numbers of MBeans comfortably.

Summary

Public Methods
final Object getAttribute(String attribute)
Obtain the value of a specific attribute of the Dynamic MBean.
final AttributeList getAttributes(String[] attributes)
Get the values of several attributes of the Dynamic MBean.
final String getClassName()
The name of this MBean's class, as used by permission checks.
MBeanInfo getMBeanInfo()
Provides the exposed attributes and actions of the Dynamic MBean using an MBeanInfo object.
final Class<?> getMBeanInterface()
final Object getResource()
The resource corresponding to this MBean.
final Object invoke(String operation, Object[] params, String[] signature)
Allows an action to be invoked on the Dynamic MBean.
final boolean isMXBean()
final void postDeregister()
Allows the MBean to perform any operations needed after having been unregistered in the MBean server.
final void postRegister(Boolean registrationDone)
Allows the MBean to perform any operations needed after having been registered in the MBean server or after the registration has failed.
final void preDeregister()
Allows the MBean to perform any operations it needs before being unregistered by the MBean server.
final ObjectName preRegister(MBeanServer server, ObjectName name)
Allows the MBean to perform any operations it needs before being registered in the MBean server.
final void preRegister2(MBeanServer server, ObjectName name)
Additional registration hook.
abstract void register(MBeanServer mbs, ObjectName name)
final void registerFailed()
Additional registration hook.
final void setAttribute(Attribute attribute)
Set the value of a specific attribute of the Dynamic MBean.
final AttributeList setAttributes(AttributeList attributes)
Sets the values of several attributes of the Dynamic MBean.
abstract void unregister()
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.sun.jmx.mbeanserver.DynamicMBean2
From interface javax.management.DynamicMBean
From interface javax.management.MBeanRegistration

Public Methods

public final Object getAttribute (String attribute)

Obtain the value of a specific attribute of the Dynamic MBean.

Parameters
attribute The name of the attribute to be retrieved
Returns
  • The value of the attribute retrieved.

public final AttributeList getAttributes (String[] attributes)

Get the values of several attributes of the Dynamic MBean.

Parameters
attributes A list of the attributes to be retrieved.
Returns
  • The list of attributes retrieved.

public final String getClassName ()

The name of this MBean's class, as used by permission checks. This is typically equal to getResource().getClass().getName(). This method is typically faster, sometimes much faster, than getMBeanInfo().getClassName(), but should return the same result.

public MBeanInfo getMBeanInfo ()

Provides the exposed attributes and actions of the Dynamic MBean using an MBeanInfo object.

Returns
  • An instance of MBeanInfo allowing all attributes and actions exposed by this Dynamic MBean to be retrieved.

public final Class<?> getMBeanInterface ()

public final Object getResource ()

The resource corresponding to this MBean. This is the object whose class name should be reflected by the MBean's getMBeanInfo().getClassName() for example. For a "plain" DynamicMBean it will be "this". For an MBean that wraps another object, like javax.management.StandardMBean, it will be the wrapped object.

public final Object invoke (String operation, Object[] params, String[] signature)

Allows an action to be invoked on the Dynamic MBean.

Parameters
operation The name of the action to be invoked.
params An array containing the parameters to be set when the action is invoked.
signature An array containing the signature of the action. The class objects will be loaded through the same class loader as the one used for loading the MBean on which the action is invoked.
Returns
  • The object returned by the action, which represents the result of invoking the action on the MBean specified.

public final boolean isMXBean ()

public final void postDeregister ()

Allows the MBean to perform any operations needed after having been unregistered in the MBean server.

public final void postRegister (Boolean registrationDone)

Allows the MBean to perform any operations needed after having been registered in the MBean server or after the registration has failed.

Parameters
registrationDone Indicates whether or not the MBean has been successfully registered in the MBean server. The value false means that the registration phase has failed.

public final void preDeregister ()

Allows the MBean to perform any operations it needs before being unregistered by the MBean server.

Throws
Exception

public final ObjectName preRegister (MBeanServer server, ObjectName name)

Allows the MBean to perform any operations it needs before being registered in the MBean server. If the name of the MBean is not specified, the MBean can provide a name for its registration. If any exception is raised, the MBean will not be registered in the MBean server.

Parameters
server The MBean server in which the MBean will be registered.
name The object name of the MBean. This name is null if the name parameter to one of the createMBean or registerMBean methods in the MBeanServer interface is null. In that case, this method must return a non-null ObjectName for the new MBean.
Returns
  • The name under which the MBean is to be registered. This value must not be null. If the name parameter is not null, it will usually but not necessarily be the returned value.
Throws
Exception

public final void preRegister2 (MBeanServer server, ObjectName name)

Additional registration hook. This method is called after preRegister. Unlike that method, if it throws an exception and the MBean implements MBeanRegistration, then postRegister(false) will be called on the MBean. This is the behavior that the MBean expects for a problem that does not come from its own preRegister method.

Throws
Exception

public abstract void register (MBeanServer mbs, ObjectName name)

Throws
Exception

public final void registerFailed ()

Additional registration hook. This method is called if preRegister and preRegister2 succeed, but then the MBean cannot be registered (for example because there is already another MBean of the same name).

public final void setAttribute (Attribute attribute)

Set the value of a specific attribute of the Dynamic MBean.

Parameters
attribute The identification of the attribute to be set and the value it is to be set to.

public final AttributeList setAttributes (AttributeList attributes)

Sets the values of several attributes of the Dynamic MBean.

Parameters
attributes A list of attributes: The identification of the attributes to be set and the values they are to be set to.
Returns
  • The list of attributes that were set, with their new values.

public abstract void unregister ()