Author: ritchiem
Date: Fri Oct 19 04:01:40 2007
New Revision: 586374

URL: http://svn.apache.org/viewvc?rev=586374&view=rev
Log:
QPID-654 : added a shutdownNow() call if the _taskPool hasn't terminiated by 
the time we have finished closing.

Modified:
    
incubator/qpid/branches/M2.1/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java

Modified: 
incubator/qpid/branches/M2.1/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java
URL: 
http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java?rev=586374&r1=586373&r2=586374&view=diff
==============================================================================
--- 
incubator/qpid/branches/M2.1/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java
 (original)
+++ 
incubator/qpid/branches/M2.1/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java
 Fri Oct 19 04:01:40 2007
@@ -300,7 +300,7 @@
                 //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 @@
 
                         _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)
                     {


Reply via email to