mirror of https://github.com/apache/activemq.git
Fix for AMQ-1340 - Thread gets stuck in a WAIT and never returns
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@559092 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8f6fac7f1b
commit
5a3a45f0c0
|
@ -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 {
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue