activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r585853 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/FilePendingMessageCursor.java
Date Thu, 18 Oct 2007 04:10:38 GMT
Author: rajdavies
Date: Wed Oct 17 21:10:37 2007
New Revision: 585853

URL: http://svn.apache.org/viewvc?rev=585853&view=rev
Log:
updated for https://issues.apache.org/activemq/browse/AMQ-1251

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/FilePendingMessageCursor.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/FilePendingMessageCursor.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/FilePendingMessageCursor.java?rev=585853&r1=585852&r2=585853&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/FilePendingMessageCursor.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/FilePendingMessageCursor.java
Wed Oct 17 21:10:37 2007
@@ -23,6 +23,7 @@
 import java.util.concurrent.atomic.AtomicLong;
 import org.apache.activemq.broker.region.Destination;
 import org.apache.activemq.broker.region.MessageReference;
+import org.apache.activemq.broker.region.QueueMessageReference;
 import org.apache.activemq.command.Message;
 import org.apache.activemq.kaha.CommandMarshaller;
 import org.apache.activemq.kaha.ListContainer;
@@ -83,8 +84,21 @@
      * @return true if there are no pending messages
      */
     public synchronized boolean isEmpty() {
-        boolean result =  memoryList.isEmpty() && isDiskListEmpty();
-        return result;
+        if(memoryList.isEmpty() && isDiskListEmpty()){
+            return true;
+        }
+        for (Iterator<MessageReference> iterator = memoryList.iterator(); iterator.hasNext();)
{
+            MessageReference node = iterator.next();
+            if (node== QueueMessageReference.NULL_MESSAGE){
+                continue;
+            }
+            if (!node.isDropped()) {
+                return false;
+            }
+            // We can remove dropped references.
+            iterator.remove();
+        }
+        return isDiskListEmpty();
     }
 
     /**



Mime
View raw message