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
This commit is contained in:
Hiram R. Chirino 2010-01-28 20:00:48 +00:00
parent 83128fc45b
commit 02d57284a4
1 changed files with 7 additions and 4 deletions

View File

@ -90,8 +90,9 @@ public class Topic extends BaseDestination implements Task {
public void initialize() throws Exception { public void initialize() throws Exception {
super.initialize(); super.initialize();
if (store != null) { if (store != null) {
int messageCount = store.getMessageCount(); // AMQ-2586: Better to leave this stat at zero than to give the user misleading metrics.
destinationStatistics.getMessages().setCount(messageCount); // 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 { 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(); destinationStatistics.getEnqueues().increment();
dispatchValve.increment(); dispatchValve.increment();
MessageEvaluationContext msgContext = null; MessageEvaluationContext msgContext = null;
@ -594,7 +596,8 @@ public class Topic extends BaseDestination implements Task {
public void messageExpired(ConnectionContext context, Subscription subs, MessageReference reference) { public void messageExpired(ConnectionContext context, Subscription subs, MessageReference reference) {
broker.messageExpired(context, 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.getEnqueues().decrement();
destinationStatistics.getExpired().increment(); destinationStatistics.getExpired().increment();
MessageAck ack = new MessageAck(); MessageAck ack = new MessageAck();