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
commit874b973366824fba1ae502b10c9a5b66c11e4779 (patch)
tree3b92ec8cc25e5ed8282bc0dd8a16f20d20d3d0dc
parentca404900574577031fe15da19be5b1d8188260cc (diff)
downloadqpid-python-874b973366824fba1ae502b10c9a5b66c11e4779.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@1475810 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java15
1 files changed, 12 insertions, 3 deletions
diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java
index 9612417266..4e885258b9 100644
--- a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java
+++ b/qpid/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);
+ }
+ }
}
}
}