diff options
author | Martin Ritchie <ritchiem@apache.org> | 2007-10-19 11:01:40 +0000 |
---|---|---|
committer | Martin Ritchie <ritchiem@apache.org> | 2007-10-19 11:01:40 +0000 |
commit | 5d226ec51a24066b33658cc0b5cdc19bbd36c53b (patch) | |
tree | 687bc89acfab461a0e61b9ffd726d5cfb4cda7ed | |
parent | 4602525b1173434cd59c682c93f5b9950ff1e271 (diff) | |
download | qpid-python-5d226ec51a24066b33658cc0b5cdc19bbd36c53b.tar.gz |
QPID-654 : added a shutdownNow() call if the _taskPool hasn't terminiated by the time we have finished closing.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/M2.1@586374 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | java/client/src/main/java/org/apache/qpid/client/AMQConnection.java | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java b/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java index 07b8d8d9b7..9abc94b3df 100644 --- a/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java +++ b/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java @@ -300,7 +300,7 @@ public class AMQConnection extends Closeable implements Connection, QueueConnect //We need to change protocol handler here as an error during the connect will not // cause the StateManager to be replaced. So the state is out of sync on reconnect // This can be seen when a exception occurs during connection. i.e. log4j NoSuchMethod. (using < 1.2.12) - _protocolHandler.setStateManager(new AMQStateManager()); + _protocolHandler.setStateManager(new AMQStateManager()); if (_logger.isInfoEnabled()) { @@ -809,6 +809,16 @@ public class AMQConnection extends Closeable implements Connection, QueueConnect _protocolHandler.closeConnection(timeout); + //If the taskpool hasn't shutdown by now then give it shutdownNow. + // This will interupt any running tasks. + if (!_taskPool.isTerminated()) + { + List<Runnable> tasks = _taskPool.shutdownNow(); + for (Runnable r : tasks) + { + _logger.warn("Connection close forced taskpool to prevent execution:" + r); + } + } } catch (AMQException e) { |