git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@597582 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2007-11-23 07:51:02 +00:00
parent ba8b248788
commit fd2c95e9bc
1 changed files with 3 additions and 1 deletions

View File

@ -104,6 +104,7 @@ public class TcpTransport extends TransportThreadSupport implements Transport, S
private Map<String, Object> socketOptions; private Map<String, Object> socketOptions;
private Boolean keepAlive; private Boolean keepAlive;
private Boolean tcpNoDelay; private Boolean tcpNoDelay;
private Thread runnerThread;
/** /**
* Connect to a remote Node - e.g. a Broker * Connect to a remote Node - e.g. a Broker
@ -165,6 +166,7 @@ public class TcpTransport extends TransportThreadSupport implements Transport, S
*/ */
public void run() { public void run() {
LOG.trace("TCP consumer thread starting"); LOG.trace("TCP consumer thread starting");
this.runnerThread=Thread.currentThread();
try { try {
while (!isStopped()) { while (!isStopped()) {
doRun(); doRun();
@ -436,7 +438,7 @@ public class TcpTransport extends TransportThreadSupport implements Transport, S
public void stop() throws Exception { public void stop() throws Exception {
super.stop(); super.stop();
CountDownLatch countDownLatch = stoppedLatch.get(); CountDownLatch countDownLatch = stoppedLatch.get();
if (countDownLatch != null) { if (countDownLatch != null && Thread.currentThread() != this.runnerThread) {
countDownLatch.await(); countDownLatch.await();
} }
} }