[jboss-cvs] JBoss Messaging SVN: r8295 - branches/Branch_1_4/src/main/org/jboss/jms/server.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu May 5 01:59:57 EDT 2011


Author: gaohoward
Date: 2011-05-05 01:59:55 -0400 (Thu, 05 May 2011)
New Revision: 8295

Modified:
   branches/Branch_1_4/src/main/org/jboss/jms/server/ServerPeer.java
Log:
JBMESSAGING-1847



Modified: branches/Branch_1_4/src/main/org/jboss/jms/server/ServerPeer.java
===================================================================
--- branches/Branch_1_4/src/main/org/jboss/jms/server/ServerPeer.java	2011-04-29 15:09:55 UTC (rev 8294)
+++ branches/Branch_1_4/src/main/org/jboss/jms/server/ServerPeer.java	2011-05-05 05:59:55 UTC (rev 8295)
@@ -379,64 +379,69 @@
       }
    }
 
-   public synchronized void stopService() throws Exception
+   public void stopService() throws Exception
    {
-      try
+      //Tell the invocation handler we are closed - this is so we don't attempt to handle
+      //any invocations when we are in a partial closing down state - which can give strange
+      //"object not found with id" exceptions and stuff like that
+      JMSServerInvocationHandler.setClosed(true);
+
+      //We move JMSServerInvocationHandler.setClosed(true) out of synchronized block
+      //to fix JBMESSAGING-1847
+      synchronized (this)
       {
-         if (!started)
+         try
          {
-            return;
-         }
+            if (!started)
+            {
+               return;
+            }
 
-         started = false;
+            started = false;
 
-         //Tell the invocation handler we are closed - this is so we don't attempt to handle
-         //any invocations when we are in a partial closing down state - which can give strange
-         //"object not found with id" exceptions and stuff like that
-         JMSServerInvocationHandler.setClosed(true);
+            // Stop the wired components
 
-         // Stop the wired components
+            messageIDManager.stop();
+            messageIDManager = null;
+            channelIDManager.stop();
+            channelIDManager = null;;
+            destinationJNDIMapper.stop();
+            destinationJNDIMapper = null;
+            connFactoryJNDIMapper.stop();
+            connFactoryJNDIMapper = null;
+            connectionManager.stop();
+            connectionManager = null;
+            connectorManager.start();
+            connectorManager = null;
+            memoryManager.stop();
+            memoryManager = null;
+            messageStore.stop();
+            messageStore = null;
+            txRepository.stop();
+            txRepository = null;
+            messageCounterManager.stop();
 
-         messageIDManager.stop();
-         messageIDManager = null;
-         channelIDManager.stop();
-         channelIDManager = null;;
-         destinationJNDIMapper.stop();
-         destinationJNDIMapper = null;
-         connFactoryJNDIMapper.stop();
-         connFactoryJNDIMapper = null;
-         connectionManager.stop();
-         connectionManager = null;
-         connectorManager.start();
-         connectorManager = null;
-         memoryManager.stop();
-         memoryManager = null;
-         messageStore.stop();
-         messageStore = null;
-         txRepository.stop();
-         txRepository = null;
-         messageCounterManager.stop();
-         
-         messageCounterManager = null;
-         if (clusterConnectionManager != null)
-         {
-            clusterConnectionManager.stop();
-         }
-         clusterConnectionManager = null;
-         postOffice = null;
+            messageCounterManager = null;
+            if (clusterConnectionManager != null)
+            {
+               clusterConnectionManager.stop();
+            }
+            clusterConnectionManager = null;
+            postOffice = null;
 
-         unloadServerAOPConfig();
+            unloadServerAOPConfig();
 
-         // TODO unloadClientAOPConfig();
+            // TODO unloadClientAOPConfig();
 
-         MessagingTimeoutFactory.instance.reset();
+            MessagingTimeoutFactory.instance.reset();
 
-         log.info("JMS " + this + " stopped");
+            log.info("JMS " + this + " stopped");
+         }
+         catch (Throwable t)
+         {
+            throw ExceptionUtil.handleJMXInvocation(t, this + " stopService");
+         }
       }
-      catch (Throwable t)
-      {
-         throw ExceptionUtil.handleJMXInvocation(t, this + " stopService");
-      }
    }
 
    // JMX Attributes -------------------------------------------------------------------------------



More information about the jboss-cvs-commits mailing list