summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRajith Muditha Attapattu <rajith@apache.org>2013-04-25 15:04:36 +0000
committerRajith Muditha Attapattu <rajith@apache.org>2013-04-25 15:04:36 +0000
commit9e6dcceed0fd126b4a67ace5dadc0d15e9510334 (patch)
treed264fd8b66e2ca441339c92dad4c81c152211169
parent2cc4c7d1ee5c794121048f6b81300a6022b13981 (diff)
downloadqpid-python-9e6dcceed0fd126b4a67ace5dadc0d15e9510334.tar.gz
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. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1475810 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--java/client/src/main/java/org/apache/qpid/client/AMQConnection.java15
1 files changed, 12 insertions, 3 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 9612417266..4e885258b9 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
@@ -909,8 +909,6 @@ public class AMQConnection extends Closeable implements Connection, QueueConnect
// 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 Closeable implements Connection, QueueConnect
}
}
}
- 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 Closeable implements Connection, QueueConnect
jmse.initCause(e);
throw jmse;
}
+ finally
+ {
+ try
+ {
+ _delegate.closeConnection(timeout);
+ }
+ catch (Exception e)
+ {
+ _logger.warn("Error closing underlying protocol connection", e);
+ }
+ }
}
}
}