From 02d57284a48f0998af5e0fb6d7d822ba8b5775fc Mon Sep 17 00:00:00 2001 From: "Hiram R. Chirino" Date: Thu, 28 Jan 2010 20:00:48 +0000 Subject: [PATCH] Fix for AMQ-2586 Topics will now report a queue size of 0. git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@904243 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/activemq/broker/region/Topic.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/Topic.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/Topic.java index 52e669bb4d..c4a1b978f4 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/Topic.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/Topic.java @@ -90,8 +90,9 @@ public class Topic extends BaseDestination implements Task { public void initialize() throws Exception { super.initialize(); if (store != null) { - int messageCount = store.getMessageCount(); - destinationStatistics.getMessages().setCount(messageCount); + // AMQ-2586: Better to leave this stat at zero than to give the user misleading metrics. + // int messageCount = store.getMessageCount(); + // destinationStatistics.getMessages().setCount(messageCount); } } @@ -563,7 +564,8 @@ public class Topic extends BaseDestination implements Task { } protected void dispatch(final ConnectionContext context, Message message) throws Exception { - destinationStatistics.getMessages().increment(); + // AMQ-2586: Better to leave this stat at zero than to give the user misleading metrics. + // destinationStatistics.getMessages().increment(); destinationStatistics.getEnqueues().increment(); dispatchValve.increment(); MessageEvaluationContext msgContext = null; @@ -594,7 +596,8 @@ public class Topic extends BaseDestination implements Task { public void messageExpired(ConnectionContext context, Subscription subs, MessageReference reference) { broker.messageExpired(context, reference); - destinationStatistics.getMessages().decrement(); + // AMQ-2586: Better to leave this stat at zero than to give the user misleading metrics. + // destinationStatistics.getMessages().decrement(); destinationStatistics.getEnqueues().decrement(); destinationStatistics.getExpired().increment(); MessageAck ack = new MessageAck();