Author: rgodfrey
Date: Thu May 29 10:05:26 2008
New Revision: 661405

URL: http://svn.apache.org/viewvc?rev=661405&view=rev
Log:
fix browser behaviour on deliverAsync(sub)

Modified:
    
incubator/qpid/branches/broker-queue-refactor/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java

Modified: 
incubator/qpid/branches/broker-queue-refactor/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java
URL: 
http://svn.apache.org/viewvc/incubator/qpid/branches/broker-queue-refactor/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java?rev=661405&r1=661404&r2=661405&view=diff
==============================================================================
--- 
incubator/qpid/branches/broker-queue-refactor/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java
 (original)
+++ 
incubator/qpid/branches/broker-queue-refactor/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java
 Thu May 29 10:05:26 2008
@@ -1242,10 +1242,12 @@
     public boolean flushSubscription(Subscription sub, long deliveries) throws 
AMQException
     {
         boolean atTail = false;
+        boolean advanced;
 
         while(!sub.isSuspended() && !atTail && deliveries != 0)
         {
 
+            advanced = false;
             sub.getSendLock();
             try
             {
@@ -1276,6 +1278,7 @@
 
                                             if(newNode != null)
                                             {
+                                                advanced = true;
                                                 sub.setLastSeenEntry(node, 
newNode);
                                                 node = sub.getLastSeenEntry();
                                             }
@@ -1300,7 +1303,7 @@
                         }
 
                     }
-                    atTail = (_entries.next(node) == null);
+                    atTail = (_entries.next(node) == null) && !advanced;
 
                 }
             }
@@ -1320,6 +1323,14 @@
             advanceAllSubscriptions();
         }
 
+        if(atTail && sub.isAutoClose())
+        {
+            unregisterSubscription(sub);
+
+            ProtocolOutputConverter converter = 
sub.getChannel().getProtocolSession().getProtocolOutputConverter();
+            
converter.confirmConsumerAutoClose(sub.getChannel().getChannelId(), 
sub.getConsumerTag());
+        }
+
         return atTail;
     }
 


Reply via email to