don't wait for ever when stopping the connection on a blocked write

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@636419 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2008-03-12 17:04:44 +00:00
parent 84792bafed
commit f67415d879
1 changed files with 7 additions and 2 deletions

View File

@ -890,7 +890,12 @@ public class TransportConnection implements Connection, Task, CommandVisitor {
@Override
public void run() {
// make sure we are not servicing client requests while we are shutting down.
serviceLock.writeLock().lock();
try {
//we could be waiting a long time if the network has gone - so only wait 1 second
serviceLock.writeLock().tryLock(1,TimeUnit.SECONDS);
} catch (InterruptedException e) {
LOG.debug("Try get writeLock interrupted ",e);
}
try {
doStop();
} catch (Throwable e) {