summaryrefslogtreecommitdiff
path: root/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java
diff options
context:
space:
mode:
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.java41
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();
}
}