mirror of https://github.com/apache/activemq.git
merging 835816 - https://issues.apache.org/activemq/browse/AMQ-2486 - systemExitOnShutdown hang
git-svn-id: https://svn.apache.org/repos/asf/activemq/branches/activemq-5.3@835820 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
50a0402e55
commit
9bd267ed8d
|
@ -31,9 +31,12 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
import javax.management.MalformedObjectNameException;
|
import javax.management.MalformedObjectNameException;
|
||||||
import javax.management.ObjectName;
|
import javax.management.ObjectName;
|
||||||
|
|
||||||
import org.apache.activemq.ActiveMQConnectionMetaData;
|
import org.apache.activemq.ActiveMQConnectionMetaData;
|
||||||
|
import org.apache.activemq.ConfigurationException;
|
||||||
import org.apache.activemq.Service;
|
import org.apache.activemq.Service;
|
||||||
import org.apache.activemq.advisory.AdvisoryBroker;
|
import org.apache.activemq.advisory.AdvisoryBroker;
|
||||||
import org.apache.activemq.broker.cluster.ConnectionSplitBroker;
|
import org.apache.activemq.broker.cluster.ConnectionSplitBroker;
|
||||||
|
@ -432,12 +435,8 @@ public class BrokerService implements Service {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if (systemExitOnShutdown) {
|
if (systemExitOnShutdown && useShutdownHook) {
|
||||||
addShutdownHook(new Runnable() {
|
throw new ConfigurationException("'useShutdownHook' property cannot be be used with 'systemExitOnShutdown', please turn it off (useShutdownHook=false)");
|
||||||
public void run() {
|
|
||||||
Runtime.getRuntime().halt(systemExitOnShutdownExitCode);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
processHelperProperties();
|
processHelperProperties();
|
||||||
if (isUseJmx()) {
|
if (isUseJmx()) {
|
||||||
|
@ -502,6 +501,15 @@ public class BrokerService implements Service {
|
||||||
if (!started.compareAndSet(true, false)) {
|
if (!started.compareAndSet(true, false)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (systemExitOnShutdown) {
|
||||||
|
new Thread() {
|
||||||
|
public void run() {
|
||||||
|
System.exit(systemExitOnShutdownExitCode);
|
||||||
|
}
|
||||||
|
}.start();
|
||||||
|
}
|
||||||
|
|
||||||
LOG.info("ActiveMQ Message Broker (" + getBrokerName() + ", " + brokerId + ") is shutting down");
|
LOG.info("ActiveMQ Message Broker (" + getBrokerName() + ", " + brokerId + ") is shutting down");
|
||||||
removeShutdownHook();
|
removeShutdownHook();
|
||||||
ServiceStopper stopper = new ServiceStopper();
|
ServiceStopper stopper = new ServiceStopper();
|
||||||
|
@ -558,6 +566,7 @@ public class BrokerService implements Service {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stopper.throwFirstException();
|
stopper.throwFirstException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue