|
|
|
@ -3268,33 +3268,32 @@ these registration behaviors are summarized on the following table: |
|
|
|
|=== |
|
|
|
|=== |
|
|
|
| Registration behavior | Explanation |
|
|
|
| Registration behavior | Explanation |
|
|
|
|
|
|
|
|
|
|
|
| `REGISTRATION_FAIL_ON_EXISTING` |
|
|
|
| `FAIL_ON_EXISTING` |
|
|
|
| This is the default registration behavior. If an `MBean` instance has already been |
|
|
|
| This is the default registration behavior. If an `MBean` instance has already been |
|
|
|
registered under the same `ObjectName`, the `MBean` that is being registered will not |
|
|
|
registered under the same `ObjectName`, the `MBean` that is being registered will not |
|
|
|
be registered and an `InstanceAlreadyExistsException` will be thrown. The existing |
|
|
|
be registered and an `InstanceAlreadyExistsException` will be thrown. The existing |
|
|
|
`MBean` is unaffected. |
|
|
|
`MBean` is unaffected. |
|
|
|
|
|
|
|
|
|
|
|
| `REGISTRATION_IGNORE_EXISTING` |
|
|
|
| `IGNORE_EXISTING` |
|
|
|
| If an `MBean` instance has already been registered under the same `ObjectName`, the |
|
|
|
| If an `MBean` instance has already been registered under the same `ObjectName`, the |
|
|
|
`MBean` that is being registered will __not__ be registered. The existing `MBean` is |
|
|
|
`MBean` that is being registered will __not__ be registered. The existing `MBean` is |
|
|
|
unaffected, and no `Exception` will be thrown. This is useful in settings where |
|
|
|
unaffected, and no `Exception` will be thrown. This is useful in settings where |
|
|
|
multiple applications want to share a common `MBean` in a shared `MBeanServer`. |
|
|
|
multiple applications want to share a common `MBean` in a shared `MBeanServer`. |
|
|
|
|
|
|
|
|
|
|
|
| `REGISTRATION_REPLACE_EXISTING` |
|
|
|
| `REPLACE_EXISTING` |
|
|
|
| If an `MBean` instance has already been registered under the same `ObjectName`, the |
|
|
|
| If an `MBean` instance has already been registered under the same `ObjectName`, the |
|
|
|
existing `MBean` that was previously registered will be unregistered and the new |
|
|
|
existing `MBean` that was previously registered will be unregistered and the new |
|
|
|
`MBean` will be registered in its place (the new `MBean` effectively replaces the |
|
|
|
`MBean` will be registered in its place (the new `MBean` effectively replaces the |
|
|
|
previous instance). |
|
|
|
previous instance). |
|
|
|
|=== |
|
|
|
|=== |
|
|
|
|
|
|
|
|
|
|
|
The above values are defined as constants on the `MBeanRegistrationSupport` class (the |
|
|
|
The above values are defined as enums on the `RegistrationPolicy` class. |
|
|
|
`MBeanExporter` class derives from this superclass). If you want to change the default |
|
|
|
If you want to change the default registration behavior, you simply need to set the value of the |
|
|
|
registration behavior, you simply need to set the value of the |
|
|
|
`registrationPolicy` property on your `MBeanExporter` definition to one of those |
|
|
|
`registrationBehaviorName` property on your `MBeanExporter` definition to one of those |
|
|
|
|
|
|
|
values. |
|
|
|
values. |
|
|
|
|
|
|
|
|
|
|
|
The following example illustrates how to effect a change from the default registration |
|
|
|
The following example illustrates how to effect a change from the default registration |
|
|
|
behavior to the `REGISTRATION_REPLACE_EXISTING` behavior: |
|
|
|
behavior to the `REPLACE_EXISTING` behavior: |
|
|
|
|
|
|
|
|
|
|
|
[source,xml,indent=0] |
|
|
|
[source,xml,indent=0] |
|
|
|
[subs="verbatim,quotes"] |
|
|
|
[subs="verbatim,quotes"] |
|
|
|
@ -3307,7 +3306,7 @@ behavior to the `REGISTRATION_REPLACE_EXISTING` behavior: |
|
|
|
<entry key="bean:name=testBean1" value-ref="testBean"/> |
|
|
|
<entry key="bean:name=testBean1" value-ref="testBean"/> |
|
|
|
</map> |
|
|
|
</map> |
|
|
|
</property> |
|
|
|
</property> |
|
|
|
<property name="registrationBehaviorName" value="REGISTRATION_REPLACE_EXISTING"/> |
|
|
|
<property name="registrationPolicy" value="REPLACE_EXISTING"/> |
|
|
|
</bean> |
|
|
|
</bean> |
|
|
|
|
|
|
|
|
|
|
|
<bean id="testBean" class="org.springframework.jmx.JmxTestBean"> |
|
|
|
<bean id="testBean" class="org.springframework.jmx.JmxTestBean"> |
|
|
|
|