Ignore NULL references when checking isEmpty

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@581568 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2007-10-03 11:24:38 +00:00
parent 69a5e00843
commit 5bd3bf6e24
1 changed files with 4 additions and 0 deletions

View File

@ -19,6 +19,7 @@ package org.apache.activemq.broker.region.cursors;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedList; import java.util.LinkedList;
import org.apache.activemq.broker.region.MessageReference; import org.apache.activemq.broker.region.MessageReference;
import org.apache.activemq.broker.region.QueueMessageReference;
/** /**
* hold pending messages in a linked list (messages awaiting disptach to a * hold pending messages in a linked list (messages awaiting disptach to a
@ -40,6 +41,9 @@ public class VMPendingMessageCursor extends AbstractPendingMessageCursor {
} else { } else {
for (Iterator<MessageReference> iterator = list.iterator(); iterator.hasNext();) { for (Iterator<MessageReference> iterator = list.iterator(); iterator.hasNext();) {
MessageReference node = iterator.next(); MessageReference node = iterator.next();
if (node== QueueMessageReference.NULL_MESSAGE){
continue;
}
if (!node.isDropped()) { if (!node.isDropped()) {
return false; return false;
} }