incubator-aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From awojtun...@apache.org
Subject svn commit: r929293 - in /incubator/aries/trunk/jmx/jmx-core/src/main/java/org/apache/aries/jmx: agent/JMXAgentImpl.java framework/BundleState.java framework/ServiceState.java
Date Tue, 30 Mar 2010 21:21:33 GMT
Author: awojtuniak
Date: Tue Mar 30 21:21:31 2010
New Revision: 929293

URL: http://svn.apache.org/viewvc?rev=929293&view=rev
Log:
ARIES-259 patch

Modified:
    incubator/aries/trunk/jmx/jmx-core/src/main/java/org/apache/aries/jmx/agent/JMXAgentImpl.java
    incubator/aries/trunk/jmx/jmx-core/src/main/java/org/apache/aries/jmx/framework/BundleState.java
    incubator/aries/trunk/jmx/jmx-core/src/main/java/org/apache/aries/jmx/framework/ServiceState.java

Modified: incubator/aries/trunk/jmx/jmx-core/src/main/java/org/apache/aries/jmx/agent/JMXAgentImpl.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jmx/jmx-core/src/main/java/org/apache/aries/jmx/agent/JMXAgentImpl.java?rev=929293&r1=929292&r2=929293&view=diff
==============================================================================
--- incubator/aries/trunk/jmx/jmx-core/src/main/java/org/apache/aries/jmx/agent/JMXAgentImpl.java
(original)
+++ incubator/aries/trunk/jmx/jmx-core/src/main/java/org/apache/aries/jmx/agent/JMXAgentImpl.java
Tue Mar 30 21:21:31 2010
@@ -147,26 +147,27 @@ public class JMXAgentImpl implements JMX
      */
     public void unregisterMBeans(final MBeanServer server) {
         for (MBeanHandler mBeanHandler : mbeansHandlers) {
-            String name = mBeanHandler.getName();
-            StandardMBean mbean = mBeanHandler.getMbean();
-            if (mbean != null) {
-                try {
-                    logger.log(LogService.LOG_INFO, "Unregistering " + mbean.getMBeanInterface().getName()
-                            + " to MBeanServer " + server + " with name " + name);
-                    server.unregisterMBean(new ObjectName(name));
-                } catch (MBeanRegistrationException e) {
-                    logger.log(LogService.LOG_ERROR, "Can't unregister MBean", e);
-                } catch (InstanceNotFoundException e) {
-                    logger.log(LogService.LOG_ERROR, "Mbena doesn't exist in the repository",
e);
-                } catch (MalformedObjectNameException e) {
-                    logger.log(LogService.LOG_ERROR, "Try to unregister with no valid objectname",
e);
-                } catch (NullPointerException e) {
-                    logger.log(LogService.LOG_ERROR, "Name of objectname can't be null ",
e);
-                } 
-            }
-
+            try
+            {
+               String name = mBeanHandler.getName();
+               StandardMBean mbean = mBeanHandler.getMbean();
+               if (mbean != null) {
+                   logger.log(LogService.LOG_INFO, "Unregistering " + mbean.getMBeanInterface().getName()
+                         + " to MBeanServer " + server + " with name " + name);
+                   server.unregisterMBean(new ObjectName(name));
+               }
+            } catch (MBeanRegistrationException e) {
+               logger.log(LogService.LOG_ERROR, "Can't unregister MBean", e);
+            } catch (InstanceNotFoundException e) {
+               logger.log(LogService.LOG_ERROR, "Mbena doesn't exist in the repository",
e);
+            } catch (MalformedObjectNameException e) {
+               logger.log(LogService.LOG_ERROR, "Try to unregister with no valid objectname",
e);
+            } catch (NullPointerException e) {
+               logger.log(LogService.LOG_ERROR, "Name of objectname can't be null ", e);
+            } catch (Exception e) {
+               logger.log(LogService.LOG_ERROR, "Cannot unregister MBean: " + mBeanHandler,
e);
+            } 
         }
-
     }
 
     /**

Modified: incubator/aries/trunk/jmx/jmx-core/src/main/java/org/apache/aries/jmx/framework/BundleState.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jmx/jmx-core/src/main/java/org/apache/aries/jmx/framework/BundleState.java?rev=929293&r1=929292&r2=929293&view=diff
==============================================================================
--- incubator/aries/trunk/jmx/jmx-core/src/main/java/org/apache/aries/jmx/framework/BundleState.java
(original)
+++ incubator/aries/trunk/jmx/jmx-core/src/main/java/org/apache/aries/jmx/framework/BundleState.java
Tue Mar 30 21:21:31 2010
@@ -347,10 +347,16 @@ public class BundleState extends Notific
 
     /*
      * Shuts down the notification dispatcher
+     * [ARIES-259] MBeans not getting unregistered reliably
      */
     protected void shutDownDispatcher() {
         if (bundleListener != null) {
-            bundleContext.removeBundleListener(bundleListener);  
+            try {
+               bundleContext.removeBundleListener(bundleListener);
+            }
+            catch (Exception e) {
+               // ignore
+            }  
         }
         if (eventDispatcher != null) {
             eventDispatcher.shutdown(); 

Modified: incubator/aries/trunk/jmx/jmx-core/src/main/java/org/apache/aries/jmx/framework/ServiceState.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jmx/jmx-core/src/main/java/org/apache/aries/jmx/framework/ServiceState.java?rev=929293&r1=929292&r2=929293&view=diff
==============================================================================
--- incubator/aries/trunk/jmx/jmx-core/src/main/java/org/apache/aries/jmx/framework/ServiceState.java
(original)
+++ incubator/aries/trunk/jmx/jmx-core/src/main/java/org/apache/aries/jmx/framework/ServiceState.java
Tue Mar 30 21:21:31 2010
@@ -206,10 +206,16 @@ public class ServiceState extends Notifi
 
     /*
      * Shuts down the notification dispatcher
+     * [ARIES-259] MBeans not getting unregistered reliably
      */
     protected void shutDownDispatcher() {
         if (serviceListener != null) {
-            bundleContext.removeServiceListener(serviceListener);
+            try {
+               bundleContext.removeServiceListener(serviceListener);
+            }
+            catch (Exception e) {
+               // ignore
+            }
         }
         if (eventDispatcher != null) {  
             eventDispatcher.shutdown();



Mime
View raw message