类 MBeanRegistrationSupport
- 直接已知子类:
ConnectorServerFactoryBean,MBeanExporter
MBeanServer. The behavior when encountering
an existing MBean at a given ObjectName is fully configurable
allowing for flexible registration settings.
All registered MBeans are tracked and can be unregistered by calling
the #unregisterBeans() method.
Sub-classes can receive notifications when an MBean is registered or
unregistered by overriding the onRegister(ObjectName) and
onUnregister(ObjectName) methods respectively.
By default, the registration process will fail if attempting to
register an MBean using a ObjectName that is
already used.
By setting the registrationPolicy
property to RegistrationPolicy.IGNORE_EXISTING the registration process
will simply ignore existing MBeans leaving them registered. This is useful in settings
where multiple applications want to share a common MBean in a shared MBeanServer.
Setting registrationPolicy property
to RegistrationPolicy.REPLACE_EXISTING will cause existing MBeans to be replaced
during registration if necessary. This is useful in situations where you can't guarantee
the state of your MBeanServer.
- 从以下版本开始:
- 4.0
- 作者:
- Rob Harrop, Juergen Hoeller, Phillip Webb
- 另请参阅:
-
字段概要
字段修饰符和类型字段说明protected final cn.taketoday.logging.LoggerLoginstance for this class.protected MBeanServerTheMBeanServerinstance being used to register beans. -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明protected voiddoRegister(Object mbean, ObjectName objectName) Actually register the MBean with the server.protected voiddoUnregister(ObjectName objectName) Actually unregister the specified MBean from the server.protected final ObjectName[]Return theObjectNamesof all registered beans.final MBeanServerReturn theMBeanServerthat the beans will be registered with.protected voidonRegister(ObjectName objectName) Called when an MBean is registered under the givenObjectName.protected voidonRegister(ObjectName objectName, Object mbean) Called when an MBean is registered under the givenObjectName.protected voidonUnregister(ObjectName objectName) Called when an MBean is unregistered under the givenObjectName.voidsetRegistrationPolicy(RegistrationPolicy registrationPolicy) The policy to use when attempting to register an MBean under anObjectNamethat already exists.voidsetServer(MBeanServer server) Specify theMBeanServerinstance with which all beans should be registered.protected voidUnregisters all beans that have been registered by an instance of this class.
-
字段详细资料
-
log
protected final cn.taketoday.logging.Logger logLoginstance for this class. -
server
TheMBeanServerinstance being used to register beans.
-
-
构造器详细资料
-
MBeanRegistrationSupport
public MBeanRegistrationSupport()
-
-
方法详细资料
-
setServer
Specify theMBeanServerinstance with which all beans should be registered. TheMBeanExporterwill attempt to locate an existingMBeanServerif none is supplied. -
getServer
Return theMBeanServerthat the beans will be registered with. -
setRegistrationPolicy
The policy to use when attempting to register an MBean under anObjectNamethat already exists.- 参数:
registrationPolicy- the policy to use- 从以下版本开始:
- 4.0
-
doRegister
Actually register the MBean with the server. The behavior when encountering an existing MBean can be configured usingsetRegistrationPolicy(cn.taketoday.jmx.support.RegistrationPolicy).- 参数:
mbean- the MBean instanceobjectName- the suggested ObjectName for the MBean- 抛出:
JMException- if the registration failed
-
unregisterBeans
protected void unregisterBeans()Unregisters all beans that have been registered by an instance of this class. -
doUnregister
Actually unregister the specified MBean from the server.- 参数:
objectName- the suggested ObjectName for the MBean
-
getRegisteredObjectNames
Return theObjectNamesof all registered beans. -
onRegister
Called when an MBean is registered under the givenObjectName. Allows subclasses to perform additional processing when an MBean is registered.The default implementation delegates to
onRegister(ObjectName).- 参数:
objectName- the actualObjectNamethat the MBean was registered withmbean- the registered MBean instance
-
onRegister
Called when an MBean is registered under the givenObjectName. Allows subclasses to perform additional processing when an MBean is registered.The default implementation is empty. Can be overridden in subclasses.
- 参数:
objectName- the actualObjectNamethat the MBean was registered with
-
onUnregister
Called when an MBean is unregistered under the givenObjectName. Allows subclasses to perform additional processing when an MBean is unregistered.The default implementation is empty. Can be overridden in subclasses.
- 参数:
objectName- theObjectNamethat the MBean was registered with
-