|
66 | 66 | import org.springframework.util.ObjectUtils; |
67 | 67 |
|
68 | 68 | /** |
69 | | - * JMX exporter that allows for exposing any <i>Spring-managed bean</i> |
70 | | - * to a JMX <code>MBeanServer</code>, without the need to define any |
| 69 | + * JMX exporter that allows for exposing any <i>Spring-managed bean</i> to a |
| 70 | + * JMX {@link javax.management.MBeanServer}, without the need to define any |
71 | 71 | * JMX-specific information in the bean classes. |
72 | 72 | * |
73 | | - * <p>If the bean implements one of the JMX management interfaces, |
74 | | - * then MBeanExporter can simply register the MBean with the server |
75 | | - * automatically, through its autodetection process. |
| 73 | + * <p>If a bean implements one of the JMX management interfaces, MBeanExporter can |
| 74 | + * simply register the MBean with the server through its autodetection process. |
76 | 75 | * |
77 | | - * <p>If the bean does not implement one of the JMX management interfaces, |
78 | | - * then MBeanExporter will create the management information using the |
79 | | - * supplied {@link MBeanInfoAssembler} implementation. |
| 76 | + * <p>If a bean does not implement one of the JMX management interfaces, MBeanExporter |
| 77 | + * will create the management information using the supplied {@link MBeanInfoAssembler}. |
80 | 78 | * |
81 | | - * <p>A list of {@link MBeanExporterListener MBeanExporterListeners} |
82 | | - * can be registered via the |
83 | | - * {@link #setListeners(MBeanExporterListener[]) listeners} property, |
84 | | - * allowing application code to be notified of MBean registration and |
85 | | - * unregistration events. |
| 79 | + * <p>A list of {@link MBeanExporterListener MBeanExporterListeners} can be registered |
| 80 | + * via the {@link #setListeners(MBeanExporterListener[]) listeners} property, allowing |
| 81 | + * application code to be notified of MBean registration and unregistration events. |
86 | 82 | * |
87 | 83 | * <p>This exporter is compatible with JMX 1.2 on Java 5 and above. |
88 | 84 | * As of Spring 2.5, it also autodetects and exports Java 6 MXBeans. |
@@ -442,7 +438,7 @@ public void destroy() { |
442 | 438 |
|
443 | 439 | public ObjectName registerManagedResource(Object managedResource) throws MBeanExportException { |
444 | 440 | Assert.notNull(managedResource, "Managed resource must not be null"); |
445 | | - ObjectName objectName = null; |
| 441 | + ObjectName objectName; |
446 | 442 | try { |
447 | 443 | objectName = getObjectName(managedResource, null); |
448 | 444 | if (this.ensureUniqueRuntimeObjectNames) { |
@@ -475,6 +471,11 @@ public void registerManagedResource(Object managedResource, ObjectName objectNam |
475 | 471 | } |
476 | 472 | } |
477 | 473 |
|
| 474 | + public void unregisterManagedResource(ObjectName objectName) { |
| 475 | + Assert.notNull(objectName, "ObjectName must not be null"); |
| 476 | + doUnregister(objectName); |
| 477 | + } |
| 478 | + |
478 | 479 |
|
479 | 480 | //--------------------------------------------------------------------- |
480 | 481 | // Exporter implementation |
|
0 commit comments