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.
setBeanFactory(BeanFactory beanFactory) This callback is only required for resolution of bean names in the "beans"
Map and for autodetection of MBeans (in the latter case,
a ListableBeanFactory is required).
public void
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 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 as the
Thread.getContextClassLoader thread context ClassLoader before allowing
any invocations on the MBean to occur.
public void
setListeners(MBeanExporterListener[] listeners) Set the MBeanExporterListeners that should be notified
of MBean registration and unregistration events.
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
Registers an individual bean with the MBeanServer. This method
is responsible for deciding how a bean should be exposed
to the MBeanServer. Specifically, if the 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: beanKey - the key associated with this bean in the beans map 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. 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 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 as the
Thread.getContextClassLoader thread context ClassLoader before allowing
any invocations on the MBean to occur. Default value is false.
public void setNotificationListenerMappings(Map listeners)(Code)
Set the
NotificationListener NotificationListeners to register with the
javax.management.MBeanServer . The key of each entry in the Map is
a String representation of the
javax.management.ObjectName of the MBean the
listener should be registered for. Specifying an asterisk (*) will cause
the listener to be associated with all MBeans registered by this class at startup time.