diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnector.java b/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnector.java index d98861f730..0c40bae55f 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnector.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnector.java @@ -146,7 +146,7 @@ public class TransportConnector implements Connector { public void onAccept(final Transport transport) { try { // Starting the connection could block due to - // wireformat negociation, so start it in an async thread. + // wireformat negotiation, so start it in an async thread. Thread startThread = new Thread("ActiveMQ Transport Initiator: "+transport.getRemoteAddress()) { public void run() { try { diff --git a/activemq-core/src/main/java/org/apache/activemq/thread/DedicatedTaskRunner.java b/activemq-core/src/main/java/org/apache/activemq/thread/DedicatedTaskRunner.java index e412101582..83de42b401 100644 --- a/activemq-core/src/main/java/org/apache/activemq/thread/DedicatedTaskRunner.java +++ b/activemq-core/src/main/java/org/apache/activemq/thread/DedicatedTaskRunner.java @@ -67,8 +67,9 @@ class DedicatedTaskRunner implements TaskRunner { pending=true; mutex.notifyAll(); - // Wait till the thread stops. - if(!threadTerminated){ + // Wait till the thread stops ( no need to wait if shutdown + // is called from thread that is shutting down) + if( Thread.currentThread()!=thread && !threadTerminated ){ mutex.wait(timeout); } } @@ -97,6 +98,9 @@ class DedicatedTaskRunner implements TaskRunner { if( !task.iterate() ) { // wait to be notified. synchronized (mutex) { + if( shutdown ) { + return; + } while( !pending ) { mutex.wait(); }