activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dej...@apache.org
Subject svn commit: r835816 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
Date Fri, 13 Nov 2009 11:26:16 GMT
Author: dejanb
Date: Fri Nov 13 11:26:16 2009
New Revision: 835816

URL: http://svn.apache.org/viewvc?rev=835816&view=rev
Log:
https://issues.apache.org/activemq/browse/AMQ-2486 - systemExitOnShutdown hang

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=835816&r1=835815&r2=835816&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 Nov 13 11:26:16 2009
@@ -31,9 +31,12 @@
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
+
 import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
+
 import org.apache.activemq.ActiveMQConnectionMetaData;
+import org.apache.activemq.ConfigurationException;
 import org.apache.activemq.Service;
 import org.apache.activemq.advisory.AdvisoryBroker;
 import org.apache.activemq.broker.cluster.ConnectionSplitBroker;
@@ -432,13 +435,9 @@
             return;
         }
         try {
-            if (systemExitOnShutdown) {
-                addShutdownHook(new Runnable() {
-                    public void run() {
-                    	Runtime.getRuntime().halt(systemExitOnShutdownExitCode);
-                    }
-                });
-            }
+        	if (systemExitOnShutdown && useShutdownHook) {
+        		throw new ConfigurationException("'useShutdownHook' property cannot be be used
with 'systemExitOnShutdown', please turn it off (useShutdownHook=false)");
+        	}
             processHelperProperties();
             if (isUseJmx()) {
             	startManagementContext();
@@ -502,6 +501,15 @@
         if (!started.compareAndSet(true, false)) {
             return;
         }
+        
+        if (systemExitOnShutdown) {
+        	new Thread() {
+        		public void run() {
+        			System.exit(systemExitOnShutdownExitCode);
+        		}
+        	}.start();
+        }
+        
         LOG.info("ActiveMQ Message Broker (" + getBrokerName() + ", " + brokerId + ") is
shutting down");
         removeShutdownHook();
         ServiceStopper stopper = new ServiceStopper();
@@ -558,6 +566,7 @@
                 }
             }
         }
+        
         stopper.throwFirstException();
     }
     



Mime
View raw message