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
This commit is contained in:
Hiram R. Chirino 2008-03-25 21:51:37 +00:00
parent 54280bcfec
commit b02c06fb31
1 changed files with 4 additions and 1 deletions

View File

@ -41,9 +41,12 @@ public class VMPendingMessageCursor extends AbstractPendingMessageCursor {
@Override
public List<MessageReference> remove(ConnectionContext context, Destination destination) throws Exception {
List<MessageReference> rc = new ArrayList<MessageReference>();
for (MessageReference r : list) {
for (Iterator<MessageReference> iterator = list.iterator(); iterator.hasNext();) {
MessageReference r = iterator.next();
if( r.getRegionDestination()==destination ) {
r.decrementReferenceCount();
rc.add(r);
iterator.remove();
}
}
return rc ;