git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@668061 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2008-06-16 06:30:25 +00:00
parent 086db1b4c6
commit 5441774883
1 changed files with 6 additions and 3 deletions

View File

@ -20,9 +20,9 @@ import java.io.IOException;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
import org.apache.activemq.advisory.AdvisorySupport; import org.apache.activemq.advisory.AdvisorySupport;
import org.apache.activemq.broker.Broker; import org.apache.activemq.broker.Broker;
import org.apache.activemq.broker.ConnectionContext; import org.apache.activemq.broker.ConnectionContext;
@ -47,7 +47,7 @@ public class StoreDurableSubscriberCursor extends AbstractPendingMessageCursor {
private String clientId; private String clientId;
private String subscriberName; private String subscriberName;
private Map<Destination, TopicStorePrefetch> topics = new HashMap<Destination, TopicStorePrefetch>(); private Map<Destination, TopicStorePrefetch> topics = new HashMap<Destination, TopicStorePrefetch>();
private LinkedList<PendingMessageCursor> storePrefetches = new LinkedList<PendingMessageCursor>(); private List<PendingMessageCursor> storePrefetches = new CopyOnWriteArrayList<PendingMessageCursor>();
private boolean started; private boolean started;
private PendingMessageCursor nonPersistent; private PendingMessageCursor nonPersistent;
private PendingMessageCursor currentCursor; private PendingMessageCursor currentCursor;
@ -322,7 +322,10 @@ public class StoreDurableSubscriberCursor extends AbstractPendingMessageCursor {
} }
} }
// round-robin // round-robin
storePrefetches.addLast(storePrefetches.removeFirst()); if (storePrefetches.size()>1) {
PendingMessageCursor first = storePrefetches.remove(0);
storePrefetches.add(first);
}
} }
return currentCursor; return currentCursor;
} }