mirror of https://github.com/apache/activemq.git
AMQ-6947 - Make sure counters are updated correct on message drop
Only update metrics counters when message is removed from the pagedInMessages list which is important to check in case of duplicates
This commit is contained in:
parent
0caa7121c6
commit
021c82859c
|
@ -1869,11 +1869,12 @@ public class Queue extends BaseDestination implements Task, UsageListener, Index
|
||||||
private void dropMessage(QueueMessageReference reference) {
|
private void dropMessage(QueueMessageReference reference) {
|
||||||
//use dropIfLive so we only process the statistics at most one time
|
//use dropIfLive so we only process the statistics at most one time
|
||||||
if (reference.dropIfLive()) {
|
if (reference.dropIfLive()) {
|
||||||
getDestinationStatistics().getDequeues().increment();
|
|
||||||
getDestinationStatistics().getMessages().decrement();
|
|
||||||
pagedInMessagesLock.writeLock().lock();
|
pagedInMessagesLock.writeLock().lock();
|
||||||
try {
|
try {
|
||||||
pagedInMessages.remove(reference);
|
if (pagedInMessages.remove(reference) != null) {
|
||||||
|
getDestinationStatistics().getDequeues().increment();
|
||||||
|
getDestinationStatistics().getMessages().decrement();
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
pagedInMessagesLock.writeLock().unlock();
|
pagedInMessagesLock.writeLock().unlock();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue