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) {
|
public void onAccept(final Transport transport) {
|
||||||
try {
|
try {
|
||||||
// Starting the connection could block due to
|
// 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()) {
|
Thread startThread = new Thread("ActiveMQ Transport Initiator: "+transport.getRemoteAddress()) {
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -67,8 +67,9 @@ class DedicatedTaskRunner implements TaskRunner {
|
||||||
pending=true;
|
pending=true;
|
||||||
mutex.notifyAll();
|
mutex.notifyAll();
|
||||||
|
|
||||||
// Wait till the thread stops.
|
// Wait till the thread stops ( no need to wait if shutdown
|
||||||
if(!threadTerminated){
|
// is called from thread that is shutting down)
|
||||||
|
if( Thread.currentThread()!=thread && !threadTerminated ){
|
||||||
mutex.wait(timeout);
|
mutex.wait(timeout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,6 +98,9 @@ class DedicatedTaskRunner implements TaskRunner {
|
||||||
if( !task.iterate() ) {
|
if( !task.iterate() ) {
|
||||||
// wait to be notified.
|
// wait to be notified.
|
||||||
synchronized (mutex) {
|
synchronized (mutex) {
|
||||||
|
if( shutdown ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
while( !pending ) {
|
while( !pending ) {
|
||||||
mutex.wait();
|
mutex.wait();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue