diff options
author | Martin Ritchie <ritchiem@apache.org> | 2009-04-11 01:38:21 +0000 |
---|---|---|
committer | Martin Ritchie <ritchiem@apache.org> | 2009-04-11 01:38:21 +0000 |
commit | 498f877a585af34af4a877031f54b8a65561c7ce (patch) | |
tree | 3067ea5360c5ff213d71ff4132fdadb6592eb18f | |
parent | 863b0182f7e73a157cc8870f03f3ee12347756bc (diff) | |
download | qpid-python-498f877a585af34af4a877031f54b8a65561c7ce.tar.gz |
QPID-1779 : Fixed the close problem so that we only send Consumer/Session closes when we have a connnection available to send the frame.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@764140 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java | 7 | ||||
-rw-r--r-- | qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer.java | 6 |
2 files changed, 10 insertions, 3 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 2782505191..ea131dd565 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 @@ -633,6 +633,7 @@ public abstract class AMQSession<C extends BasicMessageConsumer, P extends Basic // Ensure we only try and close an open session. if (!_closed.getAndSet(true)) { + _closing.set(true); synchronized (getFailoverMutex()) { // We must close down all producers and consumers in an orderly fashion. This is the only method @@ -644,8 +645,10 @@ public abstract class AMQSession<C extends BasicMessageConsumer, P extends Basic try { - // IF we are closing then send the close. - if (_connection.isClosing()) + // 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()) { sendClose(timeout); } diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer.java b/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer.java index a5f5e5f5fa..2dfecc80ac 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer.java @@ -543,6 +543,7 @@ public abstract class BasicMessageConsumer<U> extends Closeable implements Messa if (!_closed.getAndSet(true)) { + _closing.set(true); if (_logger.isDebugEnabled()) { StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace(); @@ -563,7 +564,10 @@ public abstract class BasicMessageConsumer<U> extends Closeable implements Messa { try { - if (!_connection.isClosing()) + // If the session is open or we are in the process + // of closing the session then send a cance + // no point otherwise as the connection will be gone + if (!_session.isClosed() || _session.isClosing()) { sendCancel(); } |