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 31870b110a..28fc13cfa0 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 @@ -162,11 +162,7 @@ public class OrderedPendingList implements PendingList { @Override public boolean contains(MessageReference message) { if (message != null) { - for (PendingNode value : map.values()) { - if (value.getMessage().equals(message)) { - return true; - } - } + return this.map.containsKey(message.getMessageId()); } return false; }