From b02c06fb31df198c72d78caf457343c0ac633f31 Mon Sep 17 00:00:00 2001 From: "Hiram R. Chirino" Date: Tue, 25 Mar 2008 21:51:37 +0000 Subject: [PATCH] Decrement the message reference when the messages are removed from the vm pending cursor. git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@641027 13f79535-47bb-0310-9956-ffa450edef68 --- .../broker/region/cursors/VMPendingMessageCursor.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/VMPendingMessageCursor.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/VMPendingMessageCursor.java index e4cc01f1a0..de1df3e399 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/VMPendingMessageCursor.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/VMPendingMessageCursor.java @@ -41,9 +41,12 @@ public class VMPendingMessageCursor extends AbstractPendingMessageCursor { @Override public List remove(ConnectionContext context, Destination destination) throws Exception { List rc = new ArrayList(); - for (MessageReference r : list) { + for (Iterator iterator = list.iterator(); iterator.hasNext();) { + MessageReference r = iterator.next(); if( r.getRegionDestination()==destination ) { + r.decrementReferenceCount(); rc.add(r); + iterator.remove(); } } return rc ;