APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.jmx.mbeanserver

public abstract Class MBeanSupport<M>

extends Object
implements DynamicMBean2, MBeanRegistration
Class Inheritance
All Implemented Interfaces
javax.management.MBeanRegistration, com.sun.jmx.mbeanserver.DynamicMBean2, javax.management.DynamicMBean
Known Direct Subclasses
com.sun.jmx.mbeanserver.MXBeanSupport, com.sun.jmx.mbeanserver.StandardMBeanSupport
Type Parameters
<M>
either Method or ConvertingMethod, for Standard MBeans and MXBeans respectively.
Imports
javax.management.Attribute, .AttributeList, .AttributeNotFoundException, .InvalidAttributeValueException, .MBeanException, .MBeanInfo, .MBeanRegistration, .MBeanServer, .NotCompliantMBeanException, .ObjectName, .ReflectionException, com.sun.jmx.mbeanserver.MXBeanMappingFactory

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.
Since
1.6

Field Summary

Modifier and TypeField and Description
private final MBeanInfo
private final PerInterface<M>
private final Object

Constructor Summary

AccessConstructor and Description
pack-priv <T>
MBeanSupport(T resource, Class<T> mbeanInterfaceType)

Method Summary

Modifier and TypeMethod and Description
public final Object
getAttribute(String attribute)

Implements javax.management.DynamicMBean.getAttribute.

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

public final AttributeList
getAttributes(String[] attributes)

Implements javax.management.DynamicMBean.getAttributes.

Get the values of several attributes of the Dynamic MBean.

public final String
getClassName()

Implements com.sun.jmx.mbeanserver.DynamicMBean2.getClassName.

The name of this MBean's class, as used by permission checks.

pack-priv abstract Object
getCookie()

Return a cookie for this MBean.

public MBeanInfo
getMBeanInfo()

Implements javax.management.DynamicMBean.getMBeanInfo.

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

public final Class<?>
pack-priv abstract MBeanIntrospector<M>
getMBeanIntrospector()

Return the appropriate introspector for this type of MBean.

public final Object
getResource()

Implements com.sun.jmx.mbeanserver.DynamicMBean2.getResource.

The resource corresponding to this MBean.

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

Implements javax.management.DynamicMBean.invoke.

Allows an action to be invoked on the Dynamic MBean.

public final boolean
public final void
postDeregister()

Implements javax.management.MBeanRegistration.postDeregister.

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

public final void
postRegister(Boolean registrationDone)

Implements javax.management.MBeanRegistration.postRegister.

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

public final void
preDeregister()

Implements javax.management.MBeanRegistration.preDeregister.

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

public final ObjectName
preRegister(MBeanServer server, ObjectName name)

Implements javax.management.MBeanRegistration.preRegister.

Allows the MBean to perform any operations it needs before being registered in the MBean Server.

public final void
preRegister2(MBeanServer server, ObjectName name)

Implements com.sun.jmx.mbeanserver.DynamicMBean2.preRegister2.

Additional registration hook.

public abstract void
public final void
registerFailed()

Implements com.sun.jmx.mbeanserver.DynamicMBean2.registerFailed.

Additional registration hook.

public final void
setAttribute(Attribute attribute)

Implements javax.management.DynamicMBean.setAttribute.

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

public final AttributeList
setAttributes(AttributeList attributes)

Implements javax.management.DynamicMBean.setAttributes.

Sets the values of several attributes of the Dynamic MBean.

public abstract void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

mbeanInfoback to summary
private final MBeanInfo mbeanInfo
perInterfaceback to summary
private final PerInterface<M> perInterface
resourceback to summary
private final Object resource

Constructor Detail

MBeanSupportback to summary
pack-priv <T> MBeanSupport(T resource, Class<T> mbeanInterfaceType) throws NotCompliantMBeanException

Method Detail

getAttributeback to summary
public final Object getAttribute(String attribute) throws AttributeNotFoundException, MBeanException, ReflectionException

Implements javax.management.DynamicMBean.getAttribute.

Doc from javax.management.DynamicMBean.getAttribute.

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

Exceptions
AttributeNotFoundException:
if specified attribute does not exist or cannot be retrieved
MBeanException:
Wraps a java.lang.Exception thrown by the MBean's getter.
ReflectionException:
Wraps a java.lang.Exception thrown while trying to invoke the getter.
getAttributesback to summary
public final AttributeList getAttributes(String[] attributes)

Implements javax.management.DynamicMBean.getAttributes.

Doc from javax.management.DynamicMBean.getAttributes.

Get the values of several attributes of the Dynamic MBean.

getClassNameback to summary
public final String getClassName()

Implements com.sun.jmx.mbeanserver.DynamicMBean2.getClassName.

Doc from com.sun.jmx.mbeanserver.DynamicMBean2.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.

getCookieback to summary
pack-priv abstract Object getCookie()

Return a cookie for this MBean. This cookie will be passed to MBean method invocations where it can supply additional information to the invocation. For example, with MXBeans it can be used to supply the MXBeanLookup context for resolving inter-MXBean references.

getMBeanInfoback to summary
public MBeanInfo getMBeanInfo()

Implements javax.management.DynamicMBean.getMBeanInfo.

Doc from javax.management.DynamicMBean.getMBeanInfo.

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

getMBeanInterfaceback to summary
public final Class<?> getMBeanInterface()
getMBeanIntrospectorback to summary
pack-priv abstract MBeanIntrospector<M> getMBeanIntrospector()

Return the appropriate introspector for this type of MBean.

getResourceback to summary
public final Object getResource()

Implements com.sun.jmx.mbeanserver.DynamicMBean2.getResource.

Doc from com.sun.jmx.mbeanserver.DynamicMBean2.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.

invokeback to summary
public final Object invoke(String operation, Object[] params, String[] signature) throws MBeanException, ReflectionException

Implements javax.management.DynamicMBean.invoke.

Doc from javax.management.DynamicMBean.invoke.

Allows an action to be invoked on the Dynamic MBean.

Exceptions
MBeanException:
Wraps a java.lang.Exception thrown by the MBean's invoked method.
ReflectionException:
Wraps a java.lang.Exception thrown while trying to invoke the method
isMXBeanback to summary
public final boolean isMXBean()
postDeregisterback to summary
public final void postDeregister()

Implements javax.management.MBeanRegistration.postDeregister.

Doc from javax.management.MBeanRegistration.postDeregister.

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

If the implementation of this method throws a RuntimeException or an Error, the MBean Server will rethrow those inside a RuntimeMBeanException or RuntimeErrorException, respectively. However, throwing an exception in postDeregister will not change the state of the MBean: the MBean was already successfully deregistered and will remain so.

This might be confusing for the code calling unregisterMBean(), as it might assume that MBean deregistration has failed. Therefore it is recommended that implementations of postDeregister do not throw Runtime Exceptions or Errors if it can be avoided.

postRegisterback to summary
public final void postRegister(Boolean registrationDone)

Implements javax.management.MBeanRegistration.postRegister.

Doc from javax.management.MBeanRegistration.postRegister.

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

If the implementation of this method throws a RuntimeException or an Error, the MBean Server will rethrow those inside a RuntimeMBeanException or RuntimeErrorException, respectively. However, throwing an exception in postRegister will not change the state of the MBean: if the MBean was already registered (registrationDone is true), the MBean will remain registered.

This might be confusing for the code calling createMBean() or registerMBean(), as such code might assume that MBean registration has failed when such an exception is raised. Therefore it is recommended that implementations of postRegister do not throw Runtime Exceptions or Errors if it can be avoided.

preDeregisterback to summary
public final void preDeregister() throws Exception

Implements javax.management.MBeanRegistration.preDeregister.

Doc from javax.management.MBeanRegistration.preDeregister.

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

Exceptions
Exception:
This exception will be caught by the MBean server and re-thrown as an MBeanRegistrationException.
preRegisterback to summary
public final ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception

Implements javax.management.MBeanRegistration.preRegister.

Doc from javax.management.MBeanRegistration.preRegister.

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.

Exceptions
Exception:
This exception will be caught by the MBean Server and re-thrown as an MBeanRegistrationException.
preRegister2back to summary
public final void preRegister2(MBeanServer server, ObjectName name) throws Exception

Implements com.sun.jmx.mbeanserver.DynamicMBean2.preRegister2.

Doc from com.sun.jmx.mbeanserver.DynamicMBean2.preRegister2.

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.

registerback to summary
public abstract void register(MBeanServer mbs, ObjectName name) throws Exception
registerFailedback to summary
public final void registerFailed()

Implements com.sun.jmx.mbeanserver.DynamicMBean2.registerFailed.

Doc from com.sun.jmx.mbeanserver.DynamicMBean2.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).

setAttributeback to summary
public final void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException

Implements javax.management.DynamicMBean.setAttribute.

Doc from javax.management.DynamicMBean.setAttribute.

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

Exceptions
AttributeNotFoundException:
if specified attribute does not exist or cannot be retrieved
InvalidAttributeValueException:
if value specified is not valid for the attribute
MBeanException:
Wraps a java.lang.Exception thrown by the MBean's setter.
ReflectionException:
Wraps a java.lang.Exception thrown while trying to invoke the MBean's setter.
setAttributesback to summary
public final AttributeList setAttributes(AttributeList attributes)

Implements javax.management.DynamicMBean.setAttributes.

Doc from javax.management.DynamicMBean.setAttributes.

Sets the values of several attributes of the Dynamic MBean.

unregisterback to summary
public abstract void unregister()