diff options
author | Robert Gemmell <robbie@apache.org> | 2009-04-07 22:08:02 +0000 |
---|---|---|
committer | Robert Gemmell <robbie@apache.org> | 2009-04-07 22:08:02 +0000 |
commit | d3ee6b8bd4fd318b1623fa12b6067ddb1993e134 (patch) | |
tree | 83b1c4aa74fb92fd68621035cdf7f589cf0c3802 | |
parent | cfb5d33487829f2b63e3fa08c3ba0c41b526158c (diff) | |
download | qpid-python-d3ee6b8bd4fd318b1623fa12b6067ddb1993e134.tar.gz |
QPID-1792: make JMXManagedObjectRegistry.close() method attempt to de-register only qpid related MBeans, preventing the RuntimeException that is a result of attempting to de-register the platform MBeanServerDelegate MBean, which is not allowed. Also remove unused imports.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@762992 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | java/broker/src/main/java/org/apache/qpid/server/management/JMXManagedObjectRegistry.java | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/java/broker/src/main/java/org/apache/qpid/server/management/JMXManagedObjectRegistry.java b/java/broker/src/main/java/org/apache/qpid/server/management/JMXManagedObjectRegistry.java index 3fc460b325..5a113de5be 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/management/JMXManagedObjectRegistry.java +++ b/java/broker/src/main/java/org/apache/qpid/server/management/JMXManagedObjectRegistry.java @@ -25,21 +25,14 @@ import org.apache.log4j.Logger; import org.apache.qpid.AMQException; import org.apache.qpid.server.registry.ApplicationRegistry; import org.apache.qpid.server.registry.IApplicationRegistry; -import org.apache.qpid.server.security.auth.database.Base64MD5PasswordFilePrincipalDatabase; -import org.apache.qpid.server.security.auth.database.PlainPasswordFilePrincipalDatabase; import org.apache.qpid.server.security.auth.database.PrincipalDatabase; import org.apache.qpid.server.security.auth.rmi.RMIPasswordAuthenticator; -import org.apache.qpid.server.security.auth.sasl.crammd5.CRAMMD5HashedInitialiser; -import org.apache.qpid.server.security.auth.sasl.plain.PlainInitialiser; -import javax.management.InstanceNotFoundException; import javax.management.JMException; -import javax.management.MBeanRegistrationException; import javax.management.MBeanServer; import javax.management.MBeanServerFactory; import javax.management.ObjectName; import javax.management.remote.JMXConnectorServer; -import javax.management.remote.JMXConnectorServerFactory; import javax.management.remote.JMXServiceURL; import javax.management.remote.MBeanServerForwarder; import javax.management.remote.rmi.RMIConnectorServer; @@ -342,7 +335,7 @@ public class JMXManagedObjectRegistry implements ManagedObjectRegistry return false; } - // stops the RMIRegistry, if it was running and bound to a port + // stops the RMIRegistry and unregisters the MBeans from the MBeanServer public void close() throws RemoteException { if (_rmiRegistry != null) @@ -350,7 +343,19 @@ public class JMXManagedObjectRegistry implements ManagedObjectRegistry // Stopping the RMI registry UnicastRemoteObject.unexportObject(_rmiRegistry, true); } - for (ObjectName name : _mbeanServer.queryNames(null, null)) + + //ObjectName query to gather all Qpid related MBeans + ObjectName mbeanNameQuery = null; + try + { + mbeanNameQuery = new ObjectName(ManagedObject.DOMAIN + ":*"); + } + catch (Exception e1) + { + _log.warn("Unable to generate MBean ObjectName query for close operation"); + } + + for (ObjectName name : _mbeanServer.queryNames(mbeanNameQuery, null)) { try { @@ -358,7 +363,7 @@ public class JMXManagedObjectRegistry implements ManagedObjectRegistry } catch (JMException e) { - // Really shouldn't happen, but we'll ignore that... + _log.error("Exception unregistering MBean '"+ name +"': " + e.getMessage()); } } } |