diff options
author | Aidan Skinner <aidan@apache.org> | 2009-09-09 13:05:43 +0000 |
---|---|---|
committer | Aidan Skinner <aidan@apache.org> | 2009-09-09 13:05:43 +0000 |
commit | c1ebe66bfab328c5192a35c21ea290b5c45f40f5 (patch) | |
tree | 6e61e50d92442f29287a82c22b54de6beac43b2c /qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java | |
parent | 7b28732091473d93ce7546c70fa1d2dbd685161a (diff) | |
download | qpid-python-c1ebe66bfab328c5192a35c21ea290b5c45f40f5.tar.gz |
Merge from trunk
git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/java-network-refactor@812936 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java')
-rw-r--r-- | qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java | 41 |
1 files changed, 35 insertions, 6 deletions
diff --git a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java index 2b459c858f..ca07e6acf4 100644 --- a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java +++ b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java @@ -22,6 +22,7 @@ package org.apache.qpid.management.ui.jmx; import static org.apache.qpid.management.ui.Constants.ALL; +import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.Date; @@ -29,7 +30,6 @@ import java.util.HashMap; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; -import javax.management.ListenerNotFoundException; import javax.management.MBeanInfo; import javax.management.MBeanServerConnection; import javax.management.Notification; @@ -116,25 +116,54 @@ public class JMXServerRegistry extends ServerRegistry * removes all listeners from the mbean server. This is required when user * disconnects the Qpid server connection */ - public void closeServerConnection() throws Exception + public void closeServerConnection() throws IOException { try { + //remove the listener from the JMXConnector if (_jmxc != null && _clientListener != null) + { _jmxc.removeConnectionNotificationListener(_clientListener); + } + } + catch (Exception e) + { + //ignore + } + try + { + //remove the listener from the MBeanServerDelegate MBean if (_mbsc != null && _clientListener != null) + { _mbsc.removeNotificationListener(_serverObjectName, _clientListener); + } + } + catch (Exception e) + { + //ignore + } - // remove mbean notification listeners + if (_mbsc != null && _clientListener != null) + { + //remove any listeners from the Qpid MBeans for (String mbeanName : _subscribedNotificationMap.keySet()) { - _mbsc.removeNotificationListener(new ObjectName(mbeanName), _notificationListener); + try + { + _mbsc.removeNotificationListener(new ObjectName(mbeanName), _notificationListener); + } + catch (Exception e) + { + //ignore + } } } - catch (ListenerNotFoundException ex) + + //close the JMXConnector + if (_jmxc != null) { - MBeanUtility.printOutput(ex.toString()); + _jmxc.close(); } } |