JMX exporter that allows for exposing any Spring-managed bean
to a JMX MBeanServer, without the need to define any
JMX-specific information in the bean classes.
If the bean implements one of the JMX management interfaces,
then MBeanExporter can simply register the MBean with the server
automatically, through its autodetection process.
If the bean does not implement one of the JMX management interfaces,
then MBeanExporter will create the management information using the
supplied
MBeanInfoAssembler implementation.
createAndConfigureMBean(Object managedResource, String beanKey) Creates an MBean that is configured with the appropriate management
interface for the supplied managed resource.
setBeans(Map beans) Supply a Map of beans to be registered with the JMX
MBeanServer.
The String keys are the basis for the creation of JMX object names.
By default, a JMX ObjectName will be created straight
from the given key.
public void
setEnsureUniqueRuntimeObjectNames(boolean ensureUniqueRuntimeObjectNames) Indicates whether Spring should ensure that
ObjectName ObjectNames generated by the configured
ObjectNamingStrategy for
runtime-registered MBeans should be modified to ensure uniqueness
for every instance of a managed Class.
public void
setExcludedBeans(String[] excludedBeans) Set the list of names for beans that should be excluded from autodetection.
public void
setExposeManagedResourceClassLoader(boolean exposeManagedResourceClassLoader) Indicates whether or not the managed resource should be exposed on the
Thread.getContextClassLoader thread context ClassLoader before
allowing any invocations on the MBean to occur.
<ü>The default value is true, exposing a
SpringModelMBean which performs thread context ClassLoader management.
public void
setListeners(MBeanExporterListener[] listeners) Set the MBeanExporterListeners that should be notified
of MBean registration and unregistration events.
The key of each entry in the Map is a
String representation of the
javax.management.ObjectName or the bean
name of the MBean the listener should be registered for.
Build an adapted MBean for the given bean instance, if possible.
The default implementation builds a JMX 1.2 StandardMBean
for the target's MBean/MXBean interface in case of an AOP proxy,
delegating the interface's management operations to the proxy.
Parameters: bean - the original bean instance the adapted MBean, or null if not possible
Creates an MBean that is configured with the appropriate management
interface for the supplied managed resource.
Parameters: managedResource - the resource that is to be exported as an MBean Parameters: beanKey - the key associated with the managed bean See Also:MBeanExporter.createModelMBean() See Also: See Also:MBeanExporter.getMBeanInfo(Object,String) See Also:
Create an instance of a class that implements ModelMBean.
This method is called to obtain a ModelMBean instance to
use when registering a bean. This method is called once per bean during the
registration phase and must return a new instance of ModelMBean
a new instance of a class that implements ModelMBean throws: javax.management.MBeanException - if creation of the ModelMBean failed
If the bean implements the SelfNaming interface, then the
ObjectName will be retrieved using SelfNaming.getObjectName().
Otherwise, the configured ObjectNamingStrategy is used.
Parameters: bean - the name of the bean in the BeanFactory Parameters: beanKey - the key associated with the bean in the beans map the ObjectName for the supplied bean throws: javax.management.MalformedObjectNameException - if the retrieved ObjectName is malformed
Called when an MBean is registered. Notifies all registered
MBeanExporterListener MBeanExporterListeners of the registration event.
Please note that if an
MBeanExporterListener throws a (runtime)
exception when notified, this will essentially interrupt the notification process
and any remaining listeners that have yet to be notified will not (obviously)
receive the
MBeanExporterListener.mbeanRegistered(javax.management.ObjectName) callback.
Parameters: objectName - the ObjectName of the registered MBean
Called when an MBean is unregistered. Notifies all registered
MBeanExporterListener MBeanExporterListeners of the unregistration event.
Please note that if an
MBeanExporterListener throws a (runtime)
exception when notified, this will essentially interrupt the notification process
and any remaining listeners that have yet to be notified will not (obviously)
receive the
MBeanExporterListener.mbeanUnregistered(javax.management.ObjectName) callback.
Parameters: objectName - the ObjectName of the unregistered MBean
This method is responsible for deciding how a bean
should be exposed to the MBeanServer. Specifically, if the
supplied mapValue is the name of a bean that is configured
for lazy initialization, then a proxy to the resource is registered with
the MBeanServer so that the the lazy load behavior is
honored. If the bean is already an MBean then it will be registered
directly with the MBeanServer without any intervention. For
all other beans or bean names, the resource itself is registered with
the MBeanServer directly.
Parameters: mapValue - the value configured for this bean in the beans map;may be either the String name of a bean, or the bean itself Parameters: beanKey - the key associated with this bean in the beans map the ObjectName under which the resource was registered throws: MBeanExportException - if the export failed See Also:MBeanExporter.setBeans See Also:MBeanExporter.registerBeanInstance See Also:MBeanExporter.registerLazyInit
Registers the defined beans with the
MBeanServer .
Each bean is exposed to the MBeanServer via a
ModelMBean. The actual implemetation of the
ModelMBean interface used depends on the implementation of
the ModelMBeanProvider interface that is configured. By
default the RequiredModelMBean class that is supplied with
all JMX implementations is used.
The management interface produced for each bean is dependent on the
MBeanInfoAssembler implementation being used. The
ObjectName given to each bean is dependent on the
implementation of the ObjectNamingStrategy interface being used.
Supply a Map of beans to be registered with the JMX
MBeanServer.
The String keys are the basis for the creation of JMX object names.
By default, a JMX ObjectName will be created straight
from the given key. This can be customized through specifying a
custom NamingStrategy.
public void setEnsureUniqueRuntimeObjectNames(boolean ensureUniqueRuntimeObjectNames)(Code)
Indicates whether Spring should ensure that
ObjectName ObjectNames generated by the configured
ObjectNamingStrategy for
runtime-registered MBeans should be modified to ensure uniqueness
for every instance of a managed Class.
public void setExcludedBeans(String[] excludedBeans)(Code)
Set the list of names for beans that should be excluded from autodetection.
setExposeManagedResourceClassLoader
public void setExposeManagedResourceClassLoader(boolean exposeManagedResourceClassLoader)(Code)
Indicates whether or not the managed resource should be exposed on the
Thread.getContextClassLoader thread context ClassLoader before
allowing any invocations on the MBean to occur.
<ü>The default value is true, exposing a
SpringModelMBean which performs thread context ClassLoader management. Switch this flag off to
expose a standard JMX
javax.management.modelmbean.RequiredModelMBean .
The key of each entry in the Map is a
String representation of the
javax.management.ObjectName or the bean
name of the MBean the listener should be registered for. Specifying an
asterisk (*) for a key will cause the listener to be
associated with all MBeans registered by this class at startup time.