Top Description Inners Fields Constructors Methods
javax.management

public Class StandardMBean

extends Object
implements DynamicMBean, MBeanRegistration
Class Inheritance
All Implemented Interfaces
javax.management.MBeanRegistration, javax.management.DynamicMBean
Known Direct Subclasses
javax.management.StandardEmitterMBean
Static Imports
com.sun.jmx.defaults.JmxProperties.MISC_LOGGER

An MBean whose management interface is determined by reflection on a Java interface.

This class brings more flexibility to the notion of Management Interface in the use of Standard MBeans. Straightforward use of the patterns for Standard MBeans described in the JMX Specification means that there is a fixed relationship between the implementation class of an MBean and its management interface (i.e., if the implementation class is Thing, the management interface must be ThingMBean). This class makes it possible to keep the convenience of specifying the management interface with a Java interface, without requiring that there be any naming relationship between the implementation and interface classes.

By making a DynamicMBean out of an MBean, this class makes it possible to select any interface implemented by the MBean as its management interface, provided that it complies with JMX patterns (i.e., attributes defined by getter/setter etc...).

This class also provides hooks that make it possible to supply custom descriptions and names for the MBeanInfo returned by the DynamicMBean interface.

Using this class, an MBean can be created with any implementation class name Impl and with a management interface defined (as for current Standard MBeans) by any interface Intf, in one of two general ways:

In either case, the class Impl must implement the interface Intf.

Standard MBeans based on the naming relationship between implementation and interface classes are of course still available.

This class may also be used to construct MXBeans. The usage is exactly the same as for Standard MBeans except that in the examples above, the false parameter to the constructor or super(...) invocation is instead true.

Since
1.5

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private volatile MBeanInfo
cachedMBeanInfo

The cached MBeanInfo.

private static final DescriptorCache
private volatile MBeanSupport<?>
mbean

The DynamicMBean that wraps the MXBean or Standard MBean implementation.

private static final Map<Class<?>, Boolean>
mbeanInfoSafeMap

Cached results of previous calls to immutableInfo.

Constructor Summary

AccessConstructor and Description
public <
Allows the compiler to check that implementation does indeed implement the class described by mbeanInterface. The compiler can only check this if mbeanInterface is a class literal such as MyMBean.class.
T
>
StandardMBean(T
The implementation of this MBean.
implementation
,
Class<T>
The Management Interface exported by this MBean's implementation. If null, then this object will use standard JMX design pattern to determine the management interface associated with the given implementation.
mbeanInterface
)

Make a DynamicMBean out of the object implementation, using the specified mbeanInterface class.

protected
StandardMBean(Class<?>
The Management Interface exported by this MBean.
mbeanInterface
)

Make a DynamicMBean out of this, using the specified mbeanInterface class.

public <
Allows the compiler to check that implementation does indeed implement the class described by mbeanInterface. The compiler can only check this if mbeanInterface is a class literal such as MyMBean.class.
T
>
StandardMBean(T
The implementation of this MBean.
implementation
,
Class<T>
The Management Interface exported by this MBean's implementation. If null, then this object will use standard JMX design pattern to determine the management interface associated with the given implementation.
mbeanInterface
,
boolean
If true, the mbeanInterface parameter names an MXBean interface and the resultant MBean is an MXBean.
isMXBean
)

Make a DynamicMBean out of the object implementation, using the specified mbeanInterface class, and choosing whether the resultant MBean is an MXBean.

protected
StandardMBean(Class<?>
The Management Interface exported by this MBean.
mbeanInterface
,
boolean
If true, the mbeanInterface parameter names an MXBean interface and the resultant MBean is an MXBean.
isMXBean
)

Make a DynamicMBean out of this, using the specified mbeanInterface class, and choosing whether the resulting MBean is an MXBean.

Method Summary

Modifier and TypeMethod and Description
protected void
cacheMBeanInfo(MBeanInfo
the new MBeanInfo to cache. Any previously cached value is discarded. This parameter may be null, in which case there is no new cached value.
info
)

Customization hook: cache the MBeanInfo built for this object.

private <T> void
construct(T
The implementation of this MBean. If null, and null implementation is allowed, then the implementation is assumed to be this.
implementation
,
Class<T>
The Management Interface exported by this MBean's implementation. If null, then this object will use standard JMX design pattern to determine the management interface associated with the given implementation.
mbeanInterface
,
boolean
true if a null implementation is allowed. If null implementation is allowed, and a null implementation is passed, then the implementation is assumed to be this.
nullImplementationAllowed
,
boolean isMXBean)

Make a DynamicMBean out of implementation, using the specified mbeanInterface class.

private static MBeanParameterInfo
customize(MBeanParameterInfo pi, String name, String description)

private static MBeanConstructorInfo
private static MBeanOperationInfo
customize(MBeanOperationInfo oi, String description, MBeanParameterInfo[] signature, int impact)

private static MBeanAttributeInfo
private static <T> boolean
equal(T a, T b)

public Object
getAttribute(String
The name of the attribute to be retrieved
attribute
)

Implements javax.management.DynamicMBean.getAttribute.

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

public AttributeList
getAttributes(String[]
A list of the attributes to be retrieved.
attributes
)

Implements javax.management.DynamicMBean.getAttributes.

Get the values of several attributes of the Dynamic MBean.

private MBeanAttributeInfo[]
protected MBeanInfo

Returns:

The cached MBeanInfo, or null if no MBeanInfo is cached.
getCachedMBeanInfo
()

Customization hook: Return the MBeanInfo cached for this object.

protected String

Returns:

the class name for the new MBeanInfo.
getClassName
(MBeanInfo
The default MBeanInfo derived by reflection.
info
)

Customization hook: Get the className that will be used in the MBeanInfo returned by this MBean.

protected MBeanConstructorInfo[]

Returns:

the MBeanConstructorInfo[] for the new MBeanInfo.
getConstructors
(MBeanConstructorInfo[]
The default MBeanConstructorInfo[] derived by reflection.
ctors
,
Object
The wrapped implementation. If null is passed, the wrapped implementation is ignored and ctors is returned.
impl
)

Customization hook: Get the MBeanConstructorInfo[] that will be used in the MBeanInfo returned by this MBean.

private MBeanConstructorInfo[]
protected String

Returns:

the description for the new MBeanInfo.
getDescription
(MBeanInfo
The default MBeanInfo derived by reflection.
info
)

Customization hook: Get the description that will be used in the MBeanInfo returned by this MBean.

protected String

Returns:

the description for the given MBeanFeatureInfo.
getDescription
(MBeanFeatureInfo
The default MBeanFeatureInfo derived by reflection.
info
)

Customization hook: Get the description that will be used in the MBeanFeatureInfo returned by this MBean.

protected String

Returns:

the description for the given MBeanAttributeInfo.
getDescription
(MBeanAttributeInfo
The default MBeanAttributeInfo derived by reflection.
info
)

Customization hook: Get the description that will be used in the MBeanAttributeInfo returned by this MBean.

protected String

Returns:

the description for the given MBeanConstructorInfo.
getDescription
(MBeanConstructorInfo
The default MBeanConstructorInfo derived by reflection.
info
)

Customization hook: Get the description that will be used in the MBeanConstructorInfo returned by this MBean.

protected String

Returns:

the description for the given MBeanParameterInfo.
getDescription
(MBeanConstructorInfo
The default MBeanConstructorInfo derived by reflection.
ctor
,
MBeanParameterInfo
The default MBeanParameterInfo derived by reflection.
param
,
int
The sequence number of the parameter considered ("0" for the first parameter, "1" for the second parameter, etc...).
sequence
)

Customization hook: Get the description that will be used for the sequence MBeanParameterInfo of the MBeanConstructorInfo returned by this MBean.

protected String

Returns:

the description for the given MBeanOperationInfo.
getDescription
(MBeanOperationInfo
The default MBeanOperationInfo derived by reflection.
info
)

Customization hook: Get the description that will be used in the MBeanOperationInfo returned by this MBean.

protected String

Returns:

the description for the given MBeanParameterInfo.
getDescription
(MBeanOperationInfo
The default MBeanOperationInfo derived by reflection.
op
,
MBeanParameterInfo
The default MBeanParameterInfo derived by reflection.
param
,
int
The sequence number of the parameter considered ("0" for the first parameter, "1" for the second parameter, etc...).
sequence
)

Customization hook: Get the description that will be used for the sequence MBeanParameterInfo of the MBeanOperationInfo returned by this MBean.

pack-priv Descriptor

Returns:

the Descriptor for the new MBeanInfo.
getDescriptor
(MBeanInfo
The default MBeanInfo derived by reflection.
info
,
boolean immutableInfo)

Get the Descriptor that will be used in the MBeanInfo returned by this MBean.

protected int

Returns:

the impact flag for the given MBeanOperationInfo.
getImpact
(MBeanOperationInfo
The default MBeanOperationInfo derived by reflection.
info
)

Customization hook: Get the impact flag of the operation that will be used in the MBeanOperationInfo returned by this MBean.

public Object

Returns:

The implementation of this Standard MBean (or MXBean).
getImplementation
()

Get the implementation of this Standard MBean (or MXBean).

public Class<?>

Returns:

The class of the implementation of this Standard MBean (or MXBean).
getImplementationClass
()

Get the class of the implementation of this Standard MBean (or MXBean).

public MBeanInfo

Returns:

The cached MBeanInfo for that MBean, if not null, or a newly built MBeanInfo if none was cached.
getMBeanInfo
()

Implements javax.management.DynamicMBean.getMBeanInfo.

Get the MBeanInfo for this MBean.

public final Class<?>

Returns:

The management interface of this Standard MBean (or MXBean).
getMBeanInterface
()

Get the Management Interface of this Standard MBean (or MXBean).

pack-priv MBeanNotificationInfo[]

Returns:

the MBeanNotificationInfo[] for the new MBeanInfo.
getNotifications
(MBeanInfo
The default MBeanInfo derived by reflection.
info
)

Customization hook: Get the MBeanNotificationInfo[] that will be used in the MBeanInfo returned by this MBean.

private MBeanOperationInfo[]
protected String

Returns:

the name for the given MBeanParameterInfo.
getParameterName
(MBeanConstructorInfo
The default MBeanConstructorInfo derived by reflection.
ctor
,
MBeanParameterInfo
The default MBeanParameterInfo derived by reflection.
param
,
int
The sequence number of the parameter considered ("0" for the first parameter, "1" for the second parameter, etc...).
sequence
)

Customization hook: Get the name that will be used for the sequence MBeanParameterInfo of the MBeanConstructorInfo returned by this MBean.

protected String

Returns:

the name to use for the given MBeanParameterInfo.
getParameterName
(MBeanOperationInfo
The default MBeanOperationInfo derived by reflection.
op
,
MBeanParameterInfo
The default MBeanParameterInfo derived by reflection.
param
,
int
The sequence number of the parameter considered ("0" for the first parameter, "1" for the second parameter, etc...).
sequence
)

Customization hook: Get the name that will be used for the sequence MBeanParameterInfo of the MBeanOperationInfo returned by this MBean.

private static <T> boolean
identicalArrays(T[] a, T[] b)

pack-priv static boolean
immutableInfo(Class<? extends StandardMBean> subclass)

Return true if subclass is known to preserve the immutability of the MBeanInfo.

public Object
invoke(String
The name of the action to be invoked.
actionName
,
Object[]
An array containing the parameters to be set when the action is invoked.
params
,
String[]
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.
signature
)

Implements javax.management.DynamicMBean.invoke.

Allows an action to be invoked on the Dynamic MBean.

private boolean
pack-priv static boolean
overrides(Class<?> subclass, Class<?> superclass, String name, Class<?>... params)

private static OpenMBeanParameterInfo[]
public void
postDeregister()

Implements javax.management.MBeanRegistration.postDeregister.

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

public void
postRegister(Boolean
Indicates whether or not the MBean has been successfully registered in the MBean server. The value false means that the registration phase has failed.
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 void
preDeregister()

Implements javax.management.MBeanRegistration.preDeregister.

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

public ObjectName

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.
preRegister
(MBeanServer
The MBean server in which the MBean will be registered.
server
,
ObjectName
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.
name
)

Implements javax.management.MBeanRegistration.preRegister.

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

public void
setAttribute(Attribute
The identification of the attribute to be set and the value it is to be set to.
attribute
)

Implements javax.management.DynamicMBean.setAttribute.

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

public AttributeList
setAttributes(AttributeList
A list of attributes: The identification of the attributes to be set and the values they are to be set to.
attributes
)

Implements javax.management.DynamicMBean.setAttributes.

Sets the values of several attributes of the Dynamic MBean.

public void
setImplementation(Object
The new implementation of this Standard MBean (or MXBean). The implementation object must implement the Standard MBean (or MXBean) interface that was supplied when this StandardMBean was constructed.
implementation
)

Replace the implementation object wrapped in this object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cachedMBeanInfoback to summary
private volatile MBeanInfo cachedMBeanInfo

The cached MBeanInfo.

descriptorsback to summary
private static final DescriptorCache descriptors
mbeanback to summary
private volatile MBeanSupport<?> mbean

The DynamicMBean that wraps the MXBean or Standard MBean implementation.

mbeanInfoSafeMapback to summary
private static final Map<Class<?>, Boolean> mbeanInfoSafeMap

Cached results of previous calls to immutableInfo. This is a WeakHashMap so that we don't prevent a class from being garbage collected just because we know whether its MBeanInfo is immutable.

Constructor Detail

StandardMBeanback to summary
public <T> StandardMBean(T implementation, Class<T> mbeanInterface) throws NotCompliantMBeanException

Make a DynamicMBean out of the object implementation, using the specified mbeanInterface class.

Parameters
<T>
Allows the compiler to check that implementation does indeed implement the class described by mbeanInterface. The compiler can only check this if mbeanInterface is a class literal such as MyMBean.class.
implementation:T

The implementation of this MBean.

mbeanInterface:Class<T>

The Management Interface exported by this MBean's implementation. If null, then this object will use standard JMX design pattern to determine the management interface associated with the given implementation.

Exceptions
NotCompliantMBeanException:
if the mbeanInterface does not follow JMX design patterns for Management Interfaces, or if the given implementation does not implement the specified interface.
IllegalArgumentException:
if the given implementation is null.
StandardMBeanback to summary
protected StandardMBean(Class<?> mbeanInterface) throws NotCompliantMBeanException

Make a DynamicMBean out of this, using the specified mbeanInterface class.

Calls this(this,mbeanInterface). This constructor is reserved to subclasses.

Parameters
mbeanInterface:Class<?>

The Management Interface exported by this MBean.

Exceptions
NotCompliantMBeanException:
if the mbeanInterface does not follow JMX design patterns for Management Interfaces, or if this does not implement the specified interface.
StandardMBeanback to summary
public <T> StandardMBean(T implementation, Class<T> mbeanInterface, boolean isMXBean)

Make a DynamicMBean out of the object implementation, using the specified mbeanInterface class, and choosing whether the resultant MBean is an MXBean. This constructor can be used to make either Standard MBeans or MXBeans. Unlike the constructor StandardMBean(Object, Class), it does not throw NotCompliantMBeanException.

Parameters
<T>
Allows the compiler to check that implementation does indeed implement the class described by mbeanInterface. The compiler can only check this if mbeanInterface is a class literal such as MyMBean.class.
implementation:T

The implementation of this MBean.

mbeanInterface:Class<T>

The Management Interface exported by this MBean's implementation. If null, then this object will use standard JMX design pattern to determine the management interface associated with the given implementation.

isMXBean:boolean

If true, the mbeanInterface parameter names an MXBean interface and the resultant MBean is an MXBean.

Exceptions
IllegalArgumentException:
if the given implementation is null, or if the mbeanInterface does not follow JMX design patterns for Management Interfaces, or if the given implementation does not implement the specified interface.
Since
1.6
StandardMBeanback to summary
protected StandardMBean(Class<?> mbeanInterface, boolean isMXBean)

Make a DynamicMBean out of this, using the specified mbeanInterface class, and choosing whether the resulting MBean is an MXBean. This constructor can be used to make either Standard MBeans or MXBeans. Unlike the constructor StandardMBean(Object, Class), it does not throw NotCompliantMBeanException.

Calls this(this, mbeanInterface, isMXBean). This constructor is reserved to subclasses.

Parameters
mbeanInterface:Class<?>

The Management Interface exported by this MBean.

isMXBean:boolean

If true, the mbeanInterface parameter names an MXBean interface and the resultant MBean is an MXBean.

Exceptions
IllegalArgumentException:
if the mbeanInterface does not follow JMX design patterns for Management Interfaces, or if this does not implement the specified interface.
Since
1.6

Method Detail

cacheMBeanInfoback to summary
protected void cacheMBeanInfo(MBeanInfo info)

Customization hook: cache the MBeanInfo built for this object.

Subclasses may redefine this method in order to implement their own caching policy. The default implementation stores info in this instance. A subclass can define other policies, such as not saving info (so it is reconstructed every time getMBeanInfo() is called) or sharing a unique MBeanInfo object when several StandardMBean instances have equal MBeanInfo values.

Parameters
info:MBeanInfo

the new MBeanInfo to cache. Any previously cached value is discarded. This parameter may be null, in which case there is no new cached value.

constructback to summary
private <T> void construct(T implementation, Class<T> mbeanInterface, boolean nullImplementationAllowed, boolean isMXBean) throws NotCompliantMBeanException

Make a DynamicMBean out of implementation, using the specified mbeanInterface class.

Parameters
implementation:T

The implementation of this MBean. If null, and null implementation is allowed, then the implementation is assumed to be this.

mbeanInterface:Class<T>

The Management Interface exported by this MBean's implementation. If null, then this object will use standard JMX design pattern to determine the management interface associated with the given implementation.

nullImplementationAllowed:boolean

true if a null implementation is allowed. If null implementation is allowed, and a null implementation is passed, then the implementation is assumed to be this.

Exceptions
IllegalArgumentException:
if the given implementation is null, and null is not allowed.
customizeback to summary
private static MBeanParameterInfo customize(MBeanParameterInfo pi, String name, String description)
customizeback to summary
private static MBeanConstructorInfo customize(MBeanConstructorInfo ci, String description, MBeanParameterInfo[] signature)
customizeback to summary
private static MBeanOperationInfo customize(MBeanOperationInfo oi, String description, MBeanParameterInfo[] signature, int impact)
customizeback to summary
private static MBeanAttributeInfo customize(MBeanAttributeInfo ai, String description)
equalback to summary
private static <T> boolean equal(T a, T b)
getAttributeback to summary
public 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.

Parameters
attribute:String

The name of the attribute to be retrieved

Returns:Object

The value of the attribute retrieved.

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

Parameters
attributes:String[]

A list of the attributes to be retrieved.

Returns:AttributeList

The list of attributes retrieved.

getAttributesback to summary
private MBeanAttributeInfo[] getAttributes(MBeanInfo info)
getCachedMBeanInfoback to summary
protected MBeanInfo getCachedMBeanInfo()

Customization hook: Return the MBeanInfo cached for this object.

Subclasses may redefine this method in order to implement their own caching policy. The default implementation stores one MBeanInfo object per instance.

Returns:MBeanInfo

The cached MBeanInfo, or null if no MBeanInfo is cached.

See Also
cacheMBeanInfo(MBeanInfo)
getClassNameback to summary
protected String getClassName(MBeanInfo info)

Customization hook: Get the className that will be used in the MBeanInfo returned by this MBean.
Subclasses may redefine this method in order to supply their custom class name. The default implementation returns info.getClassName().

Parameters
info:MBeanInfo

The default MBeanInfo derived by reflection.

Returns:String

the class name for the new MBeanInfo.

getConstructorsback to summary
protected MBeanConstructorInfo[] getConstructors(MBeanConstructorInfo[] ctors, Object impl)

Customization hook: Get the MBeanConstructorInfo[] that will be used in the MBeanInfo returned by this MBean.
By default, this method returns null if the wrapped implementation is not this. Indeed, if the wrapped implementation is not this object itself, it will not be possible to recreate a wrapped implementation by calling the implementation constructors through MBeanServer.createMBean(...).
Otherwise, if the wrapped implementation is this, ctors is returned.
Subclasses may redefine this method in order to modify this behavior, if needed.

Parameters
ctors:MBeanConstructorInfo[]

The default MBeanConstructorInfo[] derived by reflection.

impl:Object

The wrapped implementation. If null is passed, the wrapped implementation is ignored and ctors is returned.

Returns:MBeanConstructorInfo[]

the MBeanConstructorInfo[] for the new MBeanInfo.

getConstructorsback to summary
private MBeanConstructorInfo[] getConstructors(MBeanInfo info, Object impl)
getDescriptionback to summary
protected String getDescription(MBeanInfo info)

Customization hook: Get the description that will be used in the MBeanInfo returned by this MBean.
Subclasses may redefine this method in order to supply their custom MBean description. The default implementation returns info.getDescription().

Parameters
info:MBeanInfo

The default MBeanInfo derived by reflection.

Returns:String

the description for the new MBeanInfo.

getDescriptionback to summary
protected String getDescription(MBeanFeatureInfo info)

Customization hook: Get the description that will be used in the MBeanFeatureInfo returned by this MBean.

Subclasses may redefine this method in order to supply their custom description. The default implementation returns info.getDescription().

This method is called by getDescription(MBeanAttributeInfo), getDescription(MBeanOperationInfo), getDescription(MBeanConstructorInfo).

Parameters
info:MBeanFeatureInfo

The default MBeanFeatureInfo derived by reflection.

Returns:String

the description for the given MBeanFeatureInfo.

getDescriptionback to summary
protected String getDescription(MBeanAttributeInfo info)

Customization hook: Get the description that will be used in the MBeanAttributeInfo returned by this MBean.

Subclasses may redefine this method in order to supply their custom description. The default implementation returns getDescription((MBeanFeatureInfo) info).

Parameters
info:MBeanAttributeInfo

The default MBeanAttributeInfo derived by reflection.

Returns:String

the description for the given MBeanAttributeInfo.

getDescriptionback to summary
protected String getDescription(MBeanConstructorInfo info)

Customization hook: Get the description that will be used in the MBeanConstructorInfo returned by this MBean.
Subclasses may redefine this method in order to supply their custom description. The default implementation returns getDescription((MBeanFeatureInfo) info).

Parameters
info:MBeanConstructorInfo

The default MBeanConstructorInfo derived by reflection.

Returns:String

the description for the given MBeanConstructorInfo.

getDescriptionback to summary
protected String getDescription(MBeanConstructorInfo ctor, MBeanParameterInfo param, int sequence)

Customization hook: Get the description that will be used for the sequence MBeanParameterInfo of the MBeanConstructorInfo returned by this MBean.
Subclasses may redefine this method in order to supply their custom description. The default implementation returns param.getDescription().

Parameters
ctor:MBeanConstructorInfo

The default MBeanConstructorInfo derived by reflection.

param:MBeanParameterInfo

The default MBeanParameterInfo derived by reflection.

sequence:int

The sequence number of the parameter considered ("0" for the first parameter, "1" for the second parameter, etc...).

Returns:String

the description for the given MBeanParameterInfo.

getDescriptionback to summary
protected String getDescription(MBeanOperationInfo info)

Customization hook: Get the description that will be used in the MBeanOperationInfo returned by this MBean.
Subclasses may redefine this method in order to supply their custom description. The default implementation returns getDescription((MBeanFeatureInfo) info).

Parameters
info:MBeanOperationInfo

The default MBeanOperationInfo derived by reflection.

Returns:String

the description for the given MBeanOperationInfo.

getDescriptionback to summary
protected String getDescription(MBeanOperationInfo op, MBeanParameterInfo param, int sequence)

Customization hook: Get the description that will be used for the sequence MBeanParameterInfo of the MBeanOperationInfo returned by this MBean.
Subclasses may redefine this method in order to supply their custom description. The default implementation returns param.getDescription().

Parameters
op:MBeanOperationInfo

The default MBeanOperationInfo derived by reflection.

param:MBeanParameterInfo

The default MBeanParameterInfo derived by reflection.

sequence:int

The sequence number of the parameter considered ("0" for the first parameter, "1" for the second parameter, etc...).

Returns:String

the description for the given MBeanParameterInfo.

getDescriptorback to summary
pack-priv Descriptor getDescriptor(MBeanInfo info, boolean immutableInfo)

Get the Descriptor that will be used in the MBeanInfo returned by this MBean.

Subclasses may redefine this method in order to supply their custom descriptor.

The default implementation of this method returns a Descriptor that contains at least the field interfaceClassName, with value getMBeanInterface().getName(). It may also contain the field immutableInfo, with a value that is the string "true" if the implementation can determine that the MBeanInfo returned by getMBeanInfo() will always be the same. It may contain other fields: fields defined by the JMX specification must have appropriate values, and other fields must follow the conventions for non-standard field names.

Parameters
info:MBeanInfo

The default MBeanInfo derived by reflection.

Returns:Descriptor

the Descriptor for the new MBeanInfo.

getImpactback to summary
protected int getImpact(MBeanOperationInfo info)

Customization hook: Get the impact flag of the operation that will be used in the MBeanOperationInfo returned by this MBean.
Subclasses may redefine this method in order to supply their custom impact flag. The default implementation returns info.getImpact().

Parameters
info:MBeanOperationInfo

The default MBeanOperationInfo derived by reflection.

Returns:int

the impact flag for the given MBeanOperationInfo.

getImplementationback to summary
public Object getImplementation()

Get the implementation of this Standard MBean (or MXBean).

Returns:Object

The implementation of this Standard MBean (or MXBean).

See Also
setImplementation
getImplementationClassback to summary
public Class<?> getImplementationClass()

Get the class of the implementation of this Standard MBean (or MXBean).

Returns:Class<?>

The class of the implementation of this Standard MBean (or MXBean).

getMBeanInfoback to summary
public MBeanInfo getMBeanInfo()

Implements javax.management.DynamicMBean.getMBeanInfo.

Get the MBeanInfo for this MBean.

This method implements DynamicMBean.getMBeanInfo().

This method first calls getCachedMBeanInfo() in order to retrieve the cached MBeanInfo for this MBean, if any. If the MBeanInfo returned by getCachedMBeanInfo() is not null, then it is returned.
Otherwise, this method builds a default MBeanInfo for this MBean, using the Management Interface specified for this MBean.

While building the MBeanInfo, this method calls the customization hooks that make it possible for subclasses to supply their custom descriptions, parameter names, etc...
Finally, it calls cacheMBeanInfo() in order to cache the new MBeanInfo.

Returns:MBeanInfo

The cached MBeanInfo for that MBean, if not null, or a newly built MBeanInfo if none was cached.

getMBeanInterfaceback to summary
public final Class<?> getMBeanInterface()

Get the Management Interface of this Standard MBean (or MXBean).

Returns:Class<?>

The management interface of this Standard MBean (or MXBean).

getNotificationsback to summary
pack-priv MBeanNotificationInfo[] getNotifications(MBeanInfo info)

Customization hook: Get the MBeanNotificationInfo[] that will be used in the MBeanInfo returned by this MBean.
Subclasses may redefine this method in order to supply their custom notifications.

Parameters
info:MBeanInfo

The default MBeanInfo derived by reflection.

Returns:MBeanNotificationInfo[]

the MBeanNotificationInfo[] for the new MBeanInfo.

getOperationsback to summary
private MBeanOperationInfo[] getOperations(MBeanInfo info)
getParameterNameback to summary
protected String getParameterName(MBeanConstructorInfo ctor, MBeanParameterInfo param, int sequence)

Customization hook: Get the name that will be used for the sequence MBeanParameterInfo of the MBeanConstructorInfo returned by this MBean.
Subclasses may redefine this method in order to supply their custom parameter name. The default implementation returns param.getName().

Parameters
ctor:MBeanConstructorInfo

The default MBeanConstructorInfo derived by reflection.

param:MBeanParameterInfo

The default MBeanParameterInfo derived by reflection.

sequence:int

The sequence number of the parameter considered ("0" for the first parameter, "1" for the second parameter, etc...).

Returns:String

the name for the given MBeanParameterInfo.

getParameterNameback to summary
protected String getParameterName(MBeanOperationInfo op, MBeanParameterInfo param, int sequence)

Customization hook: Get the name that will be used for the sequence MBeanParameterInfo of the MBeanOperationInfo returned by this MBean.
Subclasses may redefine this method in order to supply their custom parameter name. The default implementation returns param.getName().

Parameters
op:MBeanOperationInfo

The default MBeanOperationInfo derived by reflection.

param:MBeanParameterInfo

The default MBeanParameterInfo derived by reflection.

sequence:int

The sequence number of the parameter considered ("0" for the first parameter, "1" for the second parameter, etc...).

Returns:String

the name to use for the given MBeanParameterInfo.

identicalArraysback to summary
private static <T> boolean identicalArrays(T[] a, T[] b)
immutableInfoback to summary
pack-priv static boolean immutableInfo(Class<? extends StandardMBean> subclass)

Return true if subclass is known to preserve the immutability of the MBeanInfo. The subclass is considered to have an immutable MBeanInfo if it does not override any of the getMBeanInfo, getCachedMBeanInfo, cacheMBeanInfo and getNotificationInfo methods.

Annotations
@SuppressWarnings:removal
invokeback to summary
public Object invoke(String actionName, 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.

Parameters
actionName:String

The name of the action to be invoked.

params:Object[]

An array containing the parameters to be set when the action is invoked.

signature:String[]

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:Object

The object returned by the action, which represents the result of invoking the action on the MBean specified.

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
private boolean isMXBean()
overridesback to summary
pack-priv static boolean overrides(Class<?> subclass, Class<?> superclass, String name, Class<?>... params)
paramsToOpenParamsback to summary
private static OpenMBeanParameterInfo[] paramsToOpenParams(MBeanParameterInfo[] params)
postDeregisterback to summary
public void postDeregister()

Implements javax.management.MBeanRegistration.postDeregister.

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

The default implementation of this method does nothing for Standard MBeans. For MXBeans, it removes any information that was recorded by the preRegister method.

It is good practice for a subclass that overrides this method to call the overridden method via super.postRegister(...). This is necessary if this object is an MXBean that is referenced by attributes or operations in other MXBeans.

Since
1.6
postRegisterback to summary
public 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.

The default implementation of this method does nothing for Standard MBeans. For MXBeans, it undoes any work done by preRegister if registration fails.

It is good practice for a subclass that overrides this method to call the overridden method via super.postRegister(...). This is necessary if this object is an MXBean that is referenced by attributes or operations in other MXBeans.

Parameters
registrationDone:Boolean

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

Since
1.6
preDeregisterback to summary
public void preDeregister() throws Exception

Implements javax.management.MBeanRegistration.preDeregister.

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

The default implementation of this method does nothing.

It is good practice for a subclass that overrides this method to call the overridden method via super.preDeregister(...).

Exceptions
Exception:
no checked exceptions are throw by this method but Exception is declared so that subclasses can override this method and throw their own exceptions.
Since
1.6
preRegisterback to summary
public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception

Implements 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.

The default implementation of this method returns the name parameter. It does nothing else for Standard MBeans. For MXBeans, it records the MBeanServer and ObjectName parameters so they can be used to translate inter-MXBean references.

It is good practice for a subclass that overrides this method to call the overridden method via super.preRegister(...). This is necessary if this object is an MXBean that is referenced by attributes or operations in other MXBeans.

Parameters
server:MBeanServer

The MBean server in which the MBean will be registered.

name:ObjectName

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:ObjectName

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.

Exceptions
Exception:
no other checked exceptions are thrown by this method but Exception is declared so that subclasses can override the method and throw their own exceptions.
IllegalArgumentException:
if this is an MXBean and name is null.
InstanceAlreadyExistsException:
if this is an MXBean and it has already been registered under another name (in this MBean Server or another).
Since
1.6
setAttributeback to summary
public 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.

Parameters
attribute:Attribute

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

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

Parameters
attributes:AttributeList

A list of attributes: The identification of the attributes to be set and the values they are to be set to.

Returns:AttributeList

The list of attributes that were set, with their new values.

setImplementationback to summary
public void setImplementation(Object implementation) throws NotCompliantMBeanException

Replace the implementation object wrapped in this object.

Parameters
implementation:Object

The new implementation of this Standard MBean (or MXBean). The implementation object must implement the Standard MBean (or MXBean) interface that was supplied when this StandardMBean was constructed.

Exceptions
NotCompliantMBeanException:
if the given implementation does not implement the Standard MBean (or MXBean) interface that was supplied at construction.
IllegalArgumentException:
if the given implementation is null.
See Also
getImplementation
javax.management back to summary

private Class StandardMBean.MBeanInfoSafeAction

extends Object
implements PrivilegedAction<Boolean>
Class Inheritance
All Implemented Interfaces
java.security.PrivilegedAction

Field Summary

Modifier and TypeField and Description
private final Class<?>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public Boolean
run()

Implements java.security.PrivilegedAction.run.

Performs the computation.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

subclassback to summary
private final Class<?> subclass

Constructor Detail

MBeanInfoSafeActionback to summary
pack-priv MBeanInfoSafeAction(Class<?> subclass)

Method Detail

runback to summary
public Boolean run()

Implements java.security.PrivilegedAction.run.

Doc from java.security.PrivilegedAction.run.

Performs the computation. This method will be called by AccessController.doPrivileged after enabling privileges.

Returns:Boolean

a class-dependent value that may represent the results of the computation. Each class that implements PrivilegedAction should document what (if anything) this value represents.