Author: ritchiem
Date: Sat Apr 11 01:46:12 2009
New Revision: 764145

URL: http://svn.apache.org/viewvc?rev=764145&view=rev
Log:
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

Modified:
    
qpid/branches/0.5-release/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java
    
qpid/branches/0.5-release/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer.java

Modified: 
qpid/branches/0.5-release/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java
URL: 
http://svn.apache.org/viewvc/qpid/branches/0.5-release/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java?rev=764145&r1=764144&r2=764145&view=diff
==============================================================================
--- 
qpid/branches/0.5-release/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java
 (original)
+++ 
qpid/branches/0.5-release/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java
 Sat Apr 11 01:46:12 2009
@@ -633,6 +633,7 @@
         // 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 @@
 
                     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);
                         }

Modified: 
qpid/branches/0.5-release/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer.java
URL: 
http://svn.apache.org/viewvc/qpid/branches/0.5-release/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer.java?rev=764145&r1=764144&r2=764145&view=diff
==============================================================================
--- 
qpid/branches/0.5-release/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer.java
 (original)
+++ 
qpid/branches/0.5-release/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer.java
 Sat Apr 11 01:46:12 2009
@@ -543,6 +543,7 @@
 
         if (!_closed.getAndSet(true))
         {
+            _closing.set(true);
             if (_logger.isDebugEnabled())
             {
                 StackTraceElement[] stackTrace = 
Thread.currentThread().getStackTrace();
@@ -563,7 +564,10 @@
                 {
                     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();
                         }



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:[email protected]

Reply via email to