[jboss-cvs] JBoss Messaging SVN: r5369 - in trunk/src/main/org/jboss/messaging/core: postoffice/impl and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Nov 17 04:57:47 EST 2008


Author: jmesnil
Date: 2008-11-17 04:57:47 -0500 (Mon, 17 Nov 2008)
New Revision: 5369

Modified:
   trunk/src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java
   trunk/src/main/org/jboss/messaging/core/postoffice/impl/PostOfficeImpl.java
Log:
synchronized the unregistration of JMX MBeans to avoid hitting a race condition and throwing a exception when unregistring an unregistered MBean

Modified: trunk/src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java	2008-11-15 09:44:35 UTC (rev 5368)
+++ trunk/src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java	2008-11-17 09:57:47 UTC (rev 5369)
@@ -349,7 +349,10 @@
       mbeanServer.registerMBean(managedResource, objectName);
    }
 
-   private void unregisterFromJMX(final ObjectName objectName) throws Exception
+   // the JMX unregistration is synchronized to avoid race conditions if 2 clients tries to 
+   // unregister the same resource (e.g. a queue) at the same time since unregisterMBean()
+   // will throw an exception if the MBean has already been unregistered 
+   private synchronized void unregisterFromJMX(final ObjectName objectName) throws Exception
    {
       if (!jmxManagementEnabled)
       {

Modified: trunk/src/main/org/jboss/messaging/core/postoffice/impl/PostOfficeImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/postoffice/impl/PostOfficeImpl.java	2008-11-15 09:44:35 UTC (rev 5368)
+++ trunk/src/main/org/jboss/messaging/core/postoffice/impl/PostOfficeImpl.java	2008-11-17 09:57:47 UTC (rev 5369)
@@ -236,18 +236,7 @@
          storageManager.deleteBinding(binding);
       }
 
-      try
-      {
-         managementService.unregisterQueue(queueName, binding.getAddress());
-      }
-      catch (Exception e)
-      {
-         //FIXME - temporary hack to get test suite running
-         //For an unknown reason this is sometimes throwing an exception and preventing
-         //the delete queue from succeeding.
-         //I suspect it is being called after the managementservice has been shut down.
-         log.warn("Failed to unregister queue", e);
-      }
+      managementService.unregisterQueue(queueName, binding.getAddress());
 
       return binding;
    }




More information about the jboss-cvs-commits mailing list