You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cs...@apache.org on 2018/04/17 12:25:35 UTC

activemq git commit: AMQ-6947 - Make sure counters are updated correct on message drop

Repository: activemq
Updated Branches:
  refs/heads/master 0caa7121c -> 021c82859


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


Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/021c8285
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/021c8285
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/021c8285

Branch: refs/heads/master
Commit: 021c82859cf4361eb31b21fdbac17655ae9e368d
Parents: 0caa712
Author: Christopher L. Shannon (cshannon) <ch...@gmail.com>
Authored: Tue Apr 17 08:23:59 2018 -0400
Committer: Christopher L. Shannon (cshannon) <ch...@gmail.com>
Committed: Tue Apr 17 08:25:08 2018 -0400

----------------------------------------------------------------------
 .../main/java/org/apache/activemq/broker/region/Queue.java    | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/021c8285/activemq-broker/src/main/java/org/apache/activemq/broker/region/Queue.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/region/Queue.java b/activemq-broker/src/main/java/org/apache/activemq/broker/region/Queue.java
index ff55e2f..64f1da2 100644
--- a/activemq-broker/src/main/java/org/apache/activemq/broker/region/Queue.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/broker/region/Queue.java
@@ -1869,11 +1869,12 @@ public class Queue extends BaseDestination implements Task, UsageListener, Index
     private void dropMessage(QueueMessageReference reference) {
         //use dropIfLive so we only process the statistics at most one time
         if (reference.dropIfLive()) {
-            getDestinationStatistics().getDequeues().increment();
-            getDestinationStatistics().getMessages().decrement();
             pagedInMessagesLock.writeLock().lock();
             try {
-                pagedInMessages.remove(reference);
+                if (pagedInMessages.remove(reference) != null) {
+                    getDestinationStatistics().getDequeues().increment();
+                    getDestinationStatistics().getMessages().decrement();
+                }
             } finally {
                 pagedInMessagesLock.writeLock().unlock();
             }