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 2016/07/29 19:58:34 UTC

activemq git commit: https://issues.apache.org/jira/browse/AMQ-6381

Repository: activemq
Updated Branches:
  refs/heads/master dd971a00f -> 82295fd2c


https://issues.apache.org/jira/browse/AMQ-6381

Fixing DurableTopicSubscription so that an ack will properly update the
forwards statistic on an ack


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

Branch: refs/heads/master
Commit: 82295fd2c6dea96433d15e00e00d53c6d41f5c0b
Parents: dd971a0
Author: Christopher L. Shannon (cshannon) <ch...@gmail.com>
Authored: Fri Jul 29 15:56:52 2016 -0400
Committer: Christopher L. Shannon (cshannon) <ch...@gmail.com>
Committed: Fri Jul 29 15:56:52 2016 -0400

----------------------------------------------------------------------
 .../activemq/broker/region/DurableTopicSubscription.java       | 3 +++
 .../java/org/apache/activemq/network/SimpleNetworkTest.java    | 6 ++++++
 2 files changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/82295fd2/activemq-broker/src/main/java/org/apache/activemq/broker/region/DurableTopicSubscription.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/region/DurableTopicSubscription.java b/activemq-broker/src/main/java/org/apache/activemq/broker/region/DurableTopicSubscription.java
index 7c43662..25f71ae 100755
--- a/activemq-broker/src/main/java/org/apache/activemq/broker/region/DurableTopicSubscription.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/broker/region/DurableTopicSubscription.java
@@ -328,6 +328,9 @@ public class DurableTopicSubscription extends PrefetchSubscription implements Us
         redeliveredMessages.remove(node.getMessageId());
         node.decrementReferenceCount();
         ((Destination)node.getRegionDestination()).getDestinationStatistics().getDequeues().increment();
+        if (info.isNetworkSubscription()) {
+            ((Destination)node.getRegionDestination()).getDestinationStatistics().getForwards().add(ack.getMessageCount());
+        }
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/activemq/blob/82295fd2/activemq-unit-tests/src/test/java/org/apache/activemq/network/SimpleNetworkTest.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/network/SimpleNetworkTest.java b/activemq-unit-tests/src/test/java/org/apache/activemq/network/SimpleNetworkTest.java
index 8a58eed..5d3376b 100755
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/network/SimpleNetworkTest.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/network/SimpleNetworkTest.java
@@ -16,6 +16,7 @@
  */
 package org.apache.activemq.network;
 
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
@@ -211,6 +212,11 @@ public class SimpleNetworkTest {
             producer.send(test);
         }
         Thread.sleep(1000);
+
+        //Make sure stats are set
+        assertEquals(MESSAGE_COUNT,
+                localBroker.getDestination(included).getDestinationStatistics().getForwards().getCount());
+
         // close everything down and restart
         doTearDown();
         doSetUp(false);