allow blocked connections to unblock so we can get in and stop them.

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@638969 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hiram R. Chirino 2008-03-19 18:45:08 +00:00
parent 2f1822bf2c
commit 31a87ac778
1 changed files with 10 additions and 7 deletions

View File

@ -892,6 +892,14 @@ public class TransportConnection implements Connection, Task, CommandVisitor {
}
}
if (stopping.compareAndSet(false, true)) {
// Let all the connection contexts know we are shutting down
// so that in progress operations can notice and unblock.
List<TransportConnectionState> connectionStates = listConnectionStates();
for (TransportConnectionState cs : connectionStates) {
cs.getContext().getStopping().set(true);
}
new Thread("ActiveMQ Transport Stopper: "+ transport.getRemoteAddress()) {
@Override
public void run() {
@ -931,13 +939,6 @@ public class TransportConnection implements Connection, Task, CommandVisitor {
LOG.trace("Exception caught stopping", ignore);
}
// Let all the connection contexts know we are shutting down
// so that in progress operations can notice and unblock.
List<TransportConnectionState> connectionStates = listConnectionStates();
for (TransportConnectionState cs : connectionStates) {
cs.getContext().getStopping().set(true);
}
try {
transport.stop();
LOG.debug("Stopped connection: " + transport.getRemoteAddress());
@ -975,6 +976,8 @@ public class TransportConnection implements Connection, Task, CommandVisitor {
// from the broker.
if (!broker.isStopped()) {
List<TransportConnectionState> connectionStates = listConnectionStates();
connectionStates = listConnectionStates();
for (TransportConnectionState cs : connectionStates) {
cs.getContext().getStopping().set(true);