activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r668061 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/StoreDurableSubscriberCursor.java
Date Mon, 16 Jun 2008 06:30:25 GMT
Author: rajdavies
Date: Sun Jun 15 23:30:25 2008
New Revision: 668061

URL: http://svn.apache.org/viewvc?rev=668061&view=rev
Log:
Fix for https://issues.apache.org/activemq/browse/AMQ-1799

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

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/StoreDurableSubscriberCursor.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/StoreDurableSubscriberCursor.java?rev=668061&r1=668060&r2=668061&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/StoreDurableSubscriberCursor.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/StoreDurableSubscriberCursor.java
Sun Jun 15 23:30:25 2008
@@ -20,9 +20,9 @@
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.CopyOnWriteArrayList;
 import org.apache.activemq.advisory.AdvisorySupport;
 import org.apache.activemq.broker.Broker;
 import org.apache.activemq.broker.ConnectionContext;
@@ -47,7 +47,7 @@
     private String clientId;
     private String subscriberName;
     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 PendingMessageCursor nonPersistent;
     private PendingMessageCursor currentCursor;
@@ -322,7 +322,10 @@
                 }
             }
             // round-robin
-            storePrefetches.addLast(storePrefetches.removeFirst());
+            if (storePrefetches.size()>1) {
+                PendingMessageCursor first = storePrefetches.remove(0);
+                storePrefetches.add(first);
+            }
         }
         return currentCursor;
     }



Mime
View raw message