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 | 7c21f856b84db3c6539b8a6c01efdcdbb8dd414f (patch) | |
| tree | 212edd28588ef1510dfa7c10e474f493aafd757c /java | |
| parent | 9ee844d41387bcdcf7d713c93fe8a38d5951b436 (diff) | |
| download | qpid-python-7c21f856b84db3c6539b8a6c01efdcdbb8dd414f.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/qpid@764140 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java')
| -rw-r--r-- | java/client/src/main/java/org/apache/qpid/client/AMQSession.java | 7 | ||||
| -rw-r--r-- | java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer.java | 6 |
2 files changed, 10 insertions, 3 deletions
diff --git a/java/client/src/main/java/org/apache/qpid/client/AMQSession.java b/java/client/src/main/java/org/apache/qpid/client/AMQSession.java index 2782505191..ea131dd565 100644 --- a/java/client/src/main/java/org/apache/qpid/client/AMQSession.java +++ b/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/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer.java b/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer.java index a5f5e5f5fa..2dfecc80ac 100644 --- a/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer.java +++ b/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(); } |
