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

This commit is contained in:
gtully 2016-05-10 11:45:27 +01:00
parent f47b370573
commit 604f707d4d
5 changed files with 2 additions and 28 deletions

View File

@ -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;

View File

@ -116,5 +116,4 @@ public interface PendingList extends Iterable<MessageReference> {
public MessageReference get(MessageId messageId);
public void insertAtHead(List<MessageReference> list);
}

View File

@ -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);
}
}
}
}

View File

@ -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);

View File

@ -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 {