javax.management.MBeanServer , without the need to define any
JMX-specific information in the bean classes.
If a bean implements one of the JMX management interfaces, MBeanExporter can simply register the MBean with the server through its auto-detection process.
If a bean does not implement one of the JMX management interfaces, MBeanExporter
will create the management information using the supplied MBeanInfoAssembler.
A list of MBeanExporterListeners can be registered
via the listeners property, allowing
application code to be notified of MBean registration and unregistration events.
This exporter is compatible with MBeans as well as MXBeans.
setBeans, setAutodetect, setAssembler, setListeners, org.springframework.jmx.export.assembler.MBeanInfoAssembler , MBeanExporterListener
| Modifier and Type | Class and Description |
|---|---|
| private static interface | MBeanExporter.AutodetectCallback
Internal callback interface for the auto-detection process. |
| private class | MBeanExporter.NotificationPublisherAwareLazyTargetSource
Extension of |
| Modifier and Type | Field and Description |
|---|---|
| private boolean | allowEagerInit
Whether to eagerly initialize candidate beans when auto-detecting MBeans. |
| private MBeanInfoAssembler | assembler
Stores the MBeanInfoAssembler to use for this exporter. |
| public static final int | AUTODETECT_ALL
Auto-detection mode indicating that all auto-detection mechanisms should be used. |
| public static final int | AUTODETECT_ASSEMBLER
Auto-detection mode indicating that only the |
| public static final int | AUTODETECT_MBEAN
Auto-detection mode indicating that only valid MBeans should be autodetected. |
| public static final int | AUTODETECT_NONE
Auto-detection mode indicating that no auto-detection should be used. |
| pack-priv Integer | autodetectMode
The autodetect mode to use for this MBeanExporter. |
| private ClassLoader | beanClassLoader
Stores the ClassLoader to use for generating lazy-init proxies. |
| private ListableBeanFactory | beanFactory
Stores the BeanFactory for use in auto-detection process. |
| private Map | beans
The beans to be exposed as JMX managed resources, with JMX names as keys. |
| private static final Map | constants
Map of constant names to constant values for the autodetect constants defined in this class. |
| private boolean | ensureUniqueRuntimeObjectNames
Indicates whether Spring should modify generated ObjectNames. |
| private final Set | excludedBeans
A set of bean names that should be excluded from auto-detection. |
| private boolean | exposeManagedResourceClassLoader
Indicates whether Spring should expose the managed resource ClassLoader in the MBean. |
| private MBeanExporterListener[] | listeners
The MBeanExporterListeners registered with this exporter. |
| private static final String | MR_TYPE_OBJECT_REFERENCE
Constant for the JMX |
| private ObjectNamingStrategy | namingStrategy
The strategy to use for creating ObjectNames for an object. |
| private NotificationListenerBean[] | notificationListeners
The NotificationListeners to register for the MBeans registered by this exporter. |
| private final Map | registeredNotificationListeners
Map of actually registered NotificationListeners. |
| private static final String | WILDCARD
Wildcard used to map a |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected DynamicMBean | Returns: the adapted MBean, ornull if not possiblethe original bean instance bean)Build an adapted MBean for the given bean instance, if possible. |
| public void | addExcludedBean(String excludedBean)
Add the name of bean that should be excluded from auto-detection. |
| public void | afterPropertiesSet()
Implements org. BeanFactory after it has set all bean properties
and satisfied BeanFactoryAware, ApplicationContextAware etc.
This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set. |
| public void | afterSingletonsInstantiated()
Implements org. |
| private void | autodetect(Map<String, Object> beans, MBeanExporter.
the callbackAutodetectCallback to use when deciding
whether to include a bean or notPerforms the actual auto-detection process, delegating to an
|
| protected ModelMBean | createAndConfigureMBean(Object
the resource that is to be exported as an MBean managedResource, String the key associated with the managed bean beanKey)Creates an MBean that is configured with the appropriate management interface for the supplied managed resource. |
| protected ModelMBean | Returns: a new instance of a class that implementsModelMBeanCreate an instance of a class that implements |
| public void | destroy()
Implements org. ApplicationContext is destroyed.
|
| private ModelMBeanInfo | getMBeanInfo(Object managedBean, String beanKey)
Gets the |
| protected ObjectName | Returns: theObjectName for the supplied beanthe name of the bean in the bean, String BeanFactorythe key associated with the bean in the beans map beanKey)Retrieve the |
| private void | injectNotificationPublisherIfNecessary(Object managedResource, ModelMBean modelMBean, ObjectName objectName)
If the supplied managed resource implements the |
| private boolean | isBeanDefinitionAbstract(ListableBeanFactory beanFactory, String beanName)
Return whether the specified bean definition should be considered as abstract. |
| protected boolean | isBeanDefinitionLazyInit(ListableBeanFactory
the bean factory that is supposed to contain the bean definition beanFactory, String the name of the bean to check beanName)Return whether the specified bean definition should be considered as lazy-init. |
| private boolean | isExcluded(String beanName)
Indicates whether a particular bean name is present in the excluded beans list. |
| protected boolean | |
| private void | notifyListenersOfRegistration(ObjectName objectName)
Notifies all registered |
| private void | notifyListenersOfUnregistration(ObjectName objectName)
Notifies all registered |
| protected void | onRegister(ObjectName
the objectName)ObjectName of the registered MBeanOverrides org. |
| protected void | onUnregister(ObjectName
the objectName)ObjectName of the unregistered MBeanOverrides org. |
| private ObjectName | Returns: theObjectName under which the bean was registered
with the MBeanServerthe bean to register, either an MBean or a plain bean bean, String the key associated with this bean in the beans map beanKey)Registers an existing MBean or an MBean adapter for a plain bean
with the |
| protected ObjectName | Returns: theObjectName under which the resource was registeredthe value configured for this bean in the beans map;
may be either the mapValue, String String name of a bean, or the bean itselfthe key associated with this bean in the beans map beanKey)Register an individual bean with the |
| protected void | |
| private ObjectName | Returns: theObjectName under which the bean was registered
with the MBeanServerthe name of the bean in the beanName, String BeanFactorythe key associated with this bean in the beans map beanKey)Register beans that are configured for lazy initialization with the
|
| public ObjectName | registerManagedResource(Object
the resource to expose via JMX managedResource)Implements org. |
| public void | registerManagedResource(Object
the resource to expose via JMX managedResource, ObjectName the objectName)ObjectName under which to expose the resourceImplements org. |
| private void | |
| private void | replaceNotificationListenerBeanNameKeysIfNecessary(String
the name of the bean to be registered beanName, ObjectName the objectName)ObjectName under which the bean will be registered
with the MBeanServerReplace any bean names used as keys in the |
| public void | setAllowEagerInit(boolean allowEagerInit)
Specify whether to allow eager initialization of candidate beans when auto-detecting MBeans in the Spring application context. |
| public void | setAssembler(MBeanInfoAssembler assembler)
Set the implementation of the |
| public void | setAutodetect(boolean autodetect)
Set whether to autodetect MBeans in the bean factory that this exporter
runs in. Will also ask an |
| public void | setAutodetectMode(int autodetectMode)
Deprecated
since 6.1. as of 6.1, in favor of the
Set the auto-detection mode to use.
"autodetect" flag
|
| public void | setAutodetectModeName(String constantName)
Deprecated
since 6.1. as of 6.1, in favor of the
Set the auto-detection mode to use by name.
"autodetect" flag
|
| public void | setBeanClassLoader(ClassLoader
the owning class loader classLoader)Implements org. class loader to
a bean instance.
|
| public void | setBeanFactory(BeanFactory
owning BeanFactory (never beanFactory)null).
The bean can immediately call methods on the factory.Implements org. "beans" Map and for
auto-detection of MBeans (in the latter case, a
ListableBeanFactory is required).
|
| public void | |
| public void | setEnsureUniqueRuntimeObjectNames(boolean ensureUniqueRuntimeObjectNames)
Indicates whether Spring should ensure that |
| public void | setExcludedBeans(String... excludedBeans)
Set the list of names for beans that should be excluded from auto-detection. |
| public void | setExposeManagedResourceClassLoader(boolean exposeManagedResourceClassLoader)
Indicates whether the managed resource should be exposed on the
|
| public void | setListeners(MBeanExporterListener... listeners)
Set the |
| public void | setNamingStrategy(ObjectNamingStrategy namingStrategy)
Set the implementation of the |
| public void | setNotificationListenerMappings(Map<?, ? extends NotificationListener> listeners)
Set the |
| public void | setNotificationListeners(NotificationListenerBean... notificationListeners)
Set the |
| public void | unregisterManagedResource(ObjectName
the objectName)ObjectName of the resource to removeImplements org. |
| private void | unregisterNotificationListeners()
Unregister the configured |