You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ra...@apache.org on 2013/04/30 18:00:47 UTC

svn commit: r1477705 - /qpid/branches/0.22/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java

Author: rajith
Date: Tue Apr 30 16:00:47 2013
New Revision: 1477705

URL: http://svn.apache.org/r1477705
Log:
QPID-4714 Moved _delegate.closeConnection method inside a finally block
to ensure the TCP connection is closed in case an exception is thrown
from any of the methods above.

(cherry picked from commit 874b973366824fba1ae502b10c9a5b66c11e4779)

Modified:
    qpid/branches/0.22/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java

Modified: qpid/branches/0.22/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.22/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java?rev=1477705&r1=1477704&r2=1477705&view=diff
==============================================================================
--- qpid/branches/0.22/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java (original)
+++ qpid/branches/0.22/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java Tue Apr 30 16:00:47 2013
@@ -909,8 +909,6 @@ public class AMQConnection extends Close
 
                         // adjust timeout
                         timeout = adjustTimeout(timeout, startCloseTime);
-                        _delegate.closeConnection(timeout);
-
                         //If the taskpool hasn't shutdown by now then give it shutdownNow.
                         // This will interupt any running tasks.
                         if (!_taskPool.isTerminated())
@@ -922,7 +920,7 @@ public class AMQConnection extends Close
                             }
                         }
                     }
-                    catch (AMQException e)
+                    catch (JMSException e)
                     {
                         _logger.error("error:", e);
                         JMSException jmse = new JMSException("Error closing connection: " + e);
@@ -930,6 +928,17 @@ public class AMQConnection extends Close
                         jmse.initCause(e);
                         throw jmse;
                     }
+                    finally
+                    {
+                        try
+                        {
+                            _delegate.closeConnection(timeout);
+                        }
+                        catch (Exception e)
+                        {
+                            _logger.warn("Error closing underlying protocol connection", e);
+                        }
+                    }
                 }
             }
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org