summaryrefslogtreecommitdiff
path: root/qpid/java
diff options
context:
space:
mode:
authorMartin Ritchie <ritchiem@apache.org>2009-04-11 01:46:12 +0000
committerMartin Ritchie <ritchiem@apache.org>2009-04-11 01:46:12 +0000
commit6c171d7b5d0b943e60af72f1a3869d404d69b973 (patch)
tree1acc55008ac17dd79bf7f68e372228633a129895 /qpid/java
parentd2bff70d55fcd8ff41e00ccb81197bbe4719eee9 (diff)
downloadqpid-python-6c171d7b5d0b943e60af72f1a3869d404d69b973.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.
merged from trunk r764140 git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/0.5-release@764145 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java')
-rw-r--r--qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java7
-rw-r--r--qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer.java6
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 9f208b67fb..7252924b04 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();
}