activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject activemq git commit: https://issues.apache.org/jira/browse/AMQ-6286 - refactor insertAtHead from pendinglist to ordered variant
Date Tue, 10 May 2016 10:45:44 GMT
Repository: activemq
Updated Branches:
  refs/heads/master f47b37057 -> 604f707d4


https://issues.apache.org/jira/browse/AMQ-6286 - refactor insertAtHead from pendinglist to
ordered variant


Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/604f707d
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/604f707d
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/604f707d

Branch: refs/heads/master
Commit: 604f707d4d69696fa18f2c58d3a46b0c282c37a8
Parents: f47b370
Author: gtully <gary.tully@gmail.com>
Authored: Tue May 10 11:45:27 2016 +0100
Committer: gtully <gary.tully@gmail.com>
Committed: Tue May 10 11:45:27 2016 +0100

----------------------------------------------------------------------
 .../broker/region/cursors/OrderedPendingList.java         |  1 -
 .../activemq/broker/region/cursors/PendingList.java       |  1 -
 .../broker/region/cursors/PrioritizedPendingList.java     | 10 ----------
 .../broker/region/cursors/QueueDispatchPendingList.java   | 10 ++--------
 .../broker/region/cursors/OrderPendingListTest.java       |  8 --------
 5 files changed, 2 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/604f707d/activemq-broker/src/main/java/org/apache/activemq/broker/region/cursors/OrderedPendingList.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/region/cursors/OrderedPendingList.java
b/activemq-broker/src/main/java/org/apache/activemq/broker/region/cursors/OrderedPendingList.java
index d0e4c47..3ce7907 100644
--- a/activemq-broker/src/main/java/org/apache/activemq/broker/region/cursors/OrderedPendingList.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/broker/region/cursors/OrderedPendingList.java
@@ -199,7 +199,6 @@ public class OrderedPendingList implements PendingList {
         return null;
     }
 
-    @Override
     public void insertAtHead(List<MessageReference> list) {
         if (list != null && !list.isEmpty()) {
             PendingNode newHead = null;

http://git-wip-us.apache.org/repos/asf/activemq/blob/604f707d/activemq-broker/src/main/java/org/apache/activemq/broker/region/cursors/PendingList.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/region/cursors/PendingList.java
b/activemq-broker/src/main/java/org/apache/activemq/broker/region/cursors/PendingList.java
index 7cc78b8..0f563e8 100644
--- a/activemq-broker/src/main/java/org/apache/activemq/broker/region/cursors/PendingList.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/broker/region/cursors/PendingList.java
@@ -116,5 +116,4 @@ public interface PendingList extends Iterable<MessageReference>
{
 
     public MessageReference get(MessageId messageId);
 
-    public void insertAtHead(List<MessageReference> list);
 }

http://git-wip-us.apache.org/repos/asf/activemq/blob/604f707d/activemq-broker/src/main/java/org/apache/activemq/broker/region/cursors/PrioritizedPendingList.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/region/cursors/PrioritizedPendingList.java
b/activemq-broker/src/main/java/org/apache/activemq/broker/region/cursors/PrioritizedPendingList.java
index cd62081..1f0e594 100644
--- a/activemq-broker/src/main/java/org/apache/activemq/broker/region/cursors/PrioritizedPendingList.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/broker/region/cursors/PrioritizedPendingList.java
@@ -206,14 +206,4 @@ public class PrioritizedPendingList implements PendingList {
         return null;
     }
 
-    @Override
-    public void insertAtHead(List<MessageReference> list) {
-        // behave like addAll - pure order within priority lists is not required
-        if (list != null) {
-            for (MessageReference ref: list) {
-                addMessageLast(ref);
-            }
-        }
-    }
-
 }

http://git-wip-us.apache.org/repos/asf/activemq/blob/604f707d/activemq-broker/src/main/java/org/apache/activemq/broker/region/cursors/QueueDispatchPendingList.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/region/cursors/QueueDispatchPendingList.java
b/activemq-broker/src/main/java/org/apache/activemq/broker/region/cursors/QueueDispatchPendingList.java
index 5aff9b3..a01795c 100644
--- a/activemq-broker/src/main/java/org/apache/activemq/broker/region/cursors/QueueDispatchPendingList.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/broker/region/cursors/QueueDispatchPendingList.java
@@ -22,7 +22,6 @@ import java.util.Iterator;
 import java.util.List;
 
 import org.apache.activemq.broker.region.MessageReference;
-import org.apache.activemq.broker.region.QueueMessageReference;
 import org.apache.activemq.command.MessageId;
 
 /**
@@ -193,11 +192,6 @@ public class QueueDispatchPendingList implements PendingList {
         return rc;
     }
 
-    @Override
-    public void insertAtHead(List<MessageReference> list) {
-        throw new IllegalStateException("no insertion support in: " + this.getClass().getCanonicalName());
-    }
-
     public void setPrioritizedMessages(boolean prioritizedMessages) {
         prioritized = prioritizedMessages;
         if (prioritizedMessages && this.pagedInPendingDispatch instanceof OrderedPendingList)
{
@@ -214,10 +208,10 @@ public class QueueDispatchPendingList implements PendingList {
     }
 
     public void addForRedelivery(List<MessageReference> list, boolean noConsumers)
{
-        if (noConsumers) {
+        if (noConsumers && redeliveredWaitingDispatch instanceof OrderedPendingList)
{
             // a single consumer can expect repeatable redelivery order irrespective
             // of transaction or prefetch boundaries
-            redeliveredWaitingDispatch.insertAtHead(list);
+            ((OrderedPendingList)redeliveredWaitingDispatch).insertAtHead(list);
         } else {
             for (MessageReference ref : list) {
                 redeliveredWaitingDispatch.addMessageLast(ref);

http://git-wip-us.apache.org/repos/asf/activemq/blob/604f707d/activemq-unit-tests/src/test/java/org/apache/activemq/broker/region/cursors/OrderPendingListTest.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/region/cursors/OrderPendingListTest.java
b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/region/cursors/OrderPendingListTest.java
index 697581e..827c39b 100644
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/region/cursors/OrderPendingListTest.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/region/cursors/OrderPendingListTest.java
@@ -20,8 +20,6 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
-import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.LinkedList;
@@ -399,12 +397,6 @@ public class OrderPendingListTest {
             }
             return null;
         }
-
-        @Override
-        public void insertAtHead(List<MessageReference> list) {
-            theList.addAll(list);
-
-        }
     }
 
     static class TestMessageReference implements MessageReference {


Mime
View raw message