Fix queue reference counting.

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@639315 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hiram R. Chirino 2008-03-20 15:31:34 +00:00
parent b3931192fc
commit c9c11074a8
2 changed files with 5 additions and 7 deletions

View File

@ -458,11 +458,10 @@ public abstract class PrefetchSubscription extends AbstractSubscription {
if (node == null) {
break;
}
if(isDropped(node)) {
pending.remove();
}
else if (canDispatch(node)) {
pending.remove();
if( !isDropped(node) && canDispatch(node)) {
// Message may have been sitting in the pending
// list a while waiting for the consumer to ak the message.
if (node != QueueMessageReference.NULL_MESSAGE

View File

@ -1002,7 +1002,6 @@ public class Queue extends BaseDestination implements Task {
reference.drop();
acknowledge(context, sub, ack, reference);
destinationStatistics.getMessages().decrement();
reference.decrementReferenceCount();
synchronized(pagedInMessages) {
pagedInMessages.remove(reference.getMessageId());
}
@ -1056,6 +1055,7 @@ public class Queue extends BaseDestination implements Task {
messages.reset();
while (messages.hasNext() && count < toPageIn) {
MessageReference node = messages.next();
node.incrementReferenceCount();
messages.remove();
if (!broker.isExpired(node)) {
QueueMessageReference ref = createMessageReference(node.getMessage());
@ -1097,7 +1097,6 @@ public class Queue extends BaseDestination implements Task {
if (dispatchSelector.canSelect(s, node)) {
if (!s.isFull()) {
s.add(node);
node.incrementReferenceCount();
target = s;
break;
} else {