summaryrefslogtreecommitdiff
path: root/qpid/java/client/src
diff options
context:
space:
mode:
authorMartin Ritchie <ritchiem@apache.org>2009-09-04 16:31:11 +0000
committerMartin Ritchie <ritchiem@apache.org>2009-09-04 16:31:11 +0000
commit99ca3ab95f2234967f2cad6228f99e32af80a505 (patch)
tree81341c6fc493b3df10d1fdf29d646db1dbcb56a6 /qpid/java/client/src
parente5521a71e0171567e29395b5ba555004635beae1 (diff)
downloadqpid-python-99ca3ab95f2234967f2cad6228f99e32af80a505.tar.gz
QPID-2081, QPID-155 : Provide a test for Dynamic Queue/Exchange toggling and fixed the issue with ChannelCloseExceptions by closing the channel and not sending the ChannelClose when the Channel has already been closed by the broker.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@811472 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/client/src')
-rw-r--r--qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java18
1 files changed, 16 insertions, 2 deletions
diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java
index 118be75705..13bc9a0eec 100644
--- a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java
+++ b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java
@@ -65,6 +65,7 @@ import org.apache.qpid.AMQDisconnectedException;
import org.apache.qpid.AMQException;
import org.apache.qpid.AMQInvalidArgumentException;
import org.apache.qpid.AMQInvalidRoutingKeyException;
+import org.apache.qpid.AMQChannelClosedException;
import org.apache.qpid.client.failover.FailoverException;
import org.apache.qpid.client.failover.FailoverNoopSupport;
import org.apache.qpid.client.failover.FailoverProtectedOperation;
@@ -629,6 +630,11 @@ public abstract class AMQSession<C extends BasicMessageConsumer, P extends Basic
*/
public void close(long timeout) throws JMSException
{
+ close(timeout, true);
+ }
+
+ private void close(long timeout, boolean sendClose) throws JMSException
+ {
if (_logger.isInfoEnabled())
{
StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
@@ -654,9 +660,12 @@ public abstract class AMQSession<C extends BasicMessageConsumer, P extends Basic
// If the connection is open or we are in the process
// of closing the connection then send a cance
// no point otherwise as the connection will be gone
- if (!_connection.isClosed() || _connection.isClosing())
+ if (!_connection.isClosed() || _connection.isClosing())
{
- sendClose(timeout);
+ if (sendClose)
+ {
+ sendClose(timeout);
+ }
}
}
catch (AMQException e)
@@ -1737,6 +1746,11 @@ public abstract class AMQSession<C extends BasicMessageConsumer, P extends Basic
}
catch (AMQException e)
{
+ if (e instanceof AMQChannelClosedException)
+ {
+ close(-1, false);
+ }
+
JMSException ex = new JMSException("Error registering consumer: " + e);
ex.setLinkedException(e);