activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1384691 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
Date Fri, 14 Sep 2012 09:13:51 GMT
Author: davsclaus
Date: Fri Sep 14 09:13:51 2012
New Revision: 1384691

URL: http://svn.apache.org/viewvc?rev=1384691&view=rev
Log:
AMQ-4044: Fixed issue with double stopping BrokerService.

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java?rev=1384691&r1=1384690&r2=1384691&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
Fri Sep 14 09:13:51 2012
@@ -186,6 +186,7 @@ public class BrokerService implements Se
     private PolicyMap destinationPolicy;
     private final AtomicBoolean started = new AtomicBoolean(false);
     private final AtomicBoolean stopped = new AtomicBoolean(false);
+    private final AtomicBoolean stopping = new AtomicBoolean(false);
     private BrokerPlugin[] plugins;
     private boolean keepDurableSubsActive = true;
     private boolean useVirtualTopics = true;
@@ -549,6 +550,7 @@ public class BrokerService implements Se
             return;
         }
 
+        stopping.set(false);
         startDate = new Date();
         MDC.put("activemq.broker", brokerName);
 
@@ -700,7 +702,8 @@ public class BrokerService implements Se
      */
     @PreDestroy
     public void stop() throws Exception {
-        if (!started.get()) {
+        if (!stopping.compareAndSet(false, true)) {
+            LOG.trace("Broker already stopping/stopped");
             return;
         }
 
@@ -795,7 +798,7 @@ public class BrokerService implements Se
                 LOG.info("Uptime {}", getUptime());
             }
             LOG.info("ActiveMQ " + getBrokerVersion() + " JMS Message Broker ("
-                    + getBrokerName() + ", " + brokerId + ") stopped");
+                    + getBrokerName() + ", " + brokerId + ") is shutdown");
         }
 
         synchronized (shutdownHooks) {



Mime
View raw message