git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1496430 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Bosanac Dejan 2013-06-25 11:48:35 +00:00
parent 06dae40d94
commit e3fb8be2ba
2 changed files with 21 additions and 8 deletions

View File

@ -563,6 +563,7 @@ public class Queue extends BaseDestination implements Task, UsageListener {
}
}
}
for (MessageReference ref : unAckedMessages) {
QueueMessageReference qmr = (QueueMessageReference) ref;
if (qmr.getLockOwner() == sub) {
@ -581,7 +582,9 @@ public class Queue extends BaseDestination implements Task, UsageListener {
}
}
}
redeliveredWaitingDispatch.addMessageLast(qmr);
if (!qmr.isDropped()) {
redeliveredWaitingDispatch.addMessageLast(qmr);
}
}
if (sub instanceof QueueBrowserSubscription) {
((QueueBrowserSubscription)sub).decrementQueueRef();
@ -1800,13 +1803,15 @@ public class Queue extends BaseDestination implements Task, UsageListener {
}
private void dropMessage(QueueMessageReference reference) {
reference.drop();
destinationStatistics.getMessages().decrement();
pagedInMessagesLock.writeLock().lock();
try{
pagedInMessages.remove(reference.getMessageId());
}finally {
pagedInMessagesLock.writeLock().unlock();
if (!reference.isDropped()) {
reference.drop();
destinationStatistics.getMessages().decrement();
pagedInMessagesLock.writeLock().lock();
try {
pagedInMessages.remove(reference.getMessageId());
} finally {
pagedInMessagesLock.writeLock().unlock();
}
}
}

View File

@ -134,6 +134,14 @@ public class QueuePurgeTest extends CombinationTestSupport {
assertEquals("Queue size is not zero, it's " + proxy.getQueueSize(), 0,
proxy.getQueueSize());
assertEquals("usage goes to duck", 0, proxy.getMemoryPercentUsage());
Message msg;
do {
msg = consumer.receive(1000);
if (msg != null) {
msg.acknowledge();
}
} while (msg != null);
assertEquals("Queue size not valid", 0, proxy.getQueueSize());
}
private QueueViewMBean getProxyToQueueViewMBean()