java.lang.Object | |
↳ | org.springframework.jmx.support.MBeanRegistrationSupport |
Known Direct Subclasses |
Known Indirect Subclasses |
Provides supporting infrastructure for registering MBeans with an
javax.management.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 registrationBehaviorName
property to REGISTRATION_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 registrationBehaviorName
property
to REGISTRATION_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
.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | REGISTRATION_FAIL_ON_EXISTING | Constant indicating that registration should fail when attempting to register an MBean under a name that already exists. | |||||||||
int | REGISTRATION_IGNORE_EXISTING | Constant indicating that registration should ignore the affected MBean when attempting to register an MBean under a name that already exists. | |||||||||
int | REGISTRATION_REPLACE_EXISTING | Constant indicating that registration should replace the affected MBean when attempting to register an MBean under a name that already exists. |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
logger | Log instance for this class. |
||||||||||
registeredBeans | The beans that have been registered by this exporter. | ||||||||||
server | The MBeanServer instance being used to register beans. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Return the
MBeanServer that the beans will be registered with. | |||||||||||
Specify what action should be taken when attempting to register an MBean
under an
ObjectName that already exists. | |||||||||||
Set the registration behavior by the name of the corresponding constant,
e.g.
| |||||||||||
Specify the
MBeanServer instance with which all beans should
be registered. |
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Actually register the MBean with the server.
| |||||||||||
Actually unregister the specified MBean from the server.
| |||||||||||
Return the
ObjectNames of all registered beans. | |||||||||||
Called when an MBean is registered under the given
ObjectName . | |||||||||||
Called when an MBean is registered under the given
ObjectName . | |||||||||||
Called when an MBean is unregistered under the given
ObjectName . | |||||||||||
Unregisters all beans that have been registered by an instance of this class.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Constant indicating that registration should fail when attempting to register an MBean under a name that already exists.
This is the default registration behavior.
Constant indicating that registration should ignore the affected MBean when attempting to register an MBean under a name that already exists.
Constant indicating that registration should replace the affected MBean when attempting to register an MBean under a name that already exists.
Log
instance for this class.
The beans that have been registered by this exporter.
Return the MBeanServer
that the beans will be registered with.
Specify what action should be taken when attempting to register an MBean
under an ObjectName
that already exists.
Default is REGISTRATION_FAIL_ON_EXISTING.
Set the registration behavior by the name of the corresponding constant, e.g. "REGISTRATION_IGNORE_EXISTING".
Specify the MBeanServer
instance with which all beans should
be registered. The MBeanExporter
will attempt to locate an
existing MBeanServer
if none is supplied.
Actually register the MBean with the server. The behavior when encountering
an existing MBean can be configured using the setRegistrationBehavior(int)
and setRegistrationBehaviorName(String)
methods.
mbean | the MBean instance |
---|---|
objectName | the suggested ObjectName for the MBean |
JMException | if the registration failed |
---|
Actually unregister the specified MBean from the server.
objectName | the suggested ObjectName for the MBean |
---|
Return the ObjectNames
of all registered beans.
Called when an MBean is registered under the given ObjectName
. Allows
subclasses to perform additional processing when an MBean is registered.
The default implementation is empty. Can be overridden in subclasses.
objectName | the actual ObjectName that the MBean was registered with
|
---|
Called when an MBean is registered under the given ObjectName
. Allows
subclasses to perform additional processing when an MBean is registered.
The default implementation delegates to onRegister(ObjectName)
.
objectName | the actual ObjectName that the MBean was registered with |
---|---|
mbean | the registered MBean instance |
Called when an MBean is unregistered under the given ObjectName
. Allows
subclasses to perform additional processing when an MBean is unregistered.
The default implementation is empty. Can be overridden in subclasses.
objectName | the ObjectName that the MBean was registered with
|
---|
Unregisters all beans that have been registered by an instance of this class.