org.jboss.messaging.core.messagecounter
Class MessageCounter

java.lang.Object
  extended by org.jboss.messaging.core.messagecounter.MessageCounter

public class MessageCounter
extends java.lang.Object

This class stores message count informations for a given queue At intervals this class samples the queue for message count data Note that the underlying queue *does not* update statistics every time a message is added since that would reall slow things down, instead we *sample* the queues at regular intervals - this means we are less intrusive on the queue

Version:
$Revision: 1.8 $
Author:
Ulf Schroeter, Stephan Steinbacher, Tim Fox

Nested Class Summary
static class MessageCounter.DayCounter
          Internal day counter class for one day hour based counter history
 
Constructor Summary
MessageCounter(java.lang.String name, java.lang.String subscription, QueueControl queue, boolean topic, boolean durable, int daycountmax)
          Constructor
 
Method Summary
 long getCount()
          Gets the total message count since startup or last counter reset
 long getCountDelta()
          Gets the message count delta since last method call
 java.lang.String getDestinationName()
           
 java.lang.String getDestinationSubscription()
           
 java.util.List<MessageCounter.DayCounter> getHistory()
           
 java.lang.String getHistoryAsString()
          Get message counter history data as string in format "day count\n Date 1, hour counter 0, hour counter 1, ..., hour counter 23\n Date 2, hour counter 0, hour counter 1, ..., hour counter 23\n .....
 long getLastAddedMessageTime()
           
 long getLastUpdate()
           
 int getMessageCount()
          Gets the current message count of pending messages within the destination waiting for dispatch
 int getMessageCountDelta()
          Gets the message count delta of pending messages since last method call.
 boolean isDestinationDurable()
           
 boolean isDestinationTopic()
           
 void onTimer()
           
 void resetCounter()
           
 void resetHistory()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MessageCounter

public MessageCounter(java.lang.String name,
                      java.lang.String subscription,
                      QueueControl queue,
                      boolean topic,
                      boolean durable,
                      int daycountmax)
Constructor

Parameters:
name - destination name
subscription - subscription name
queue - internal queue object
topic - topic destination flag
durable - durable subsciption flag
daycountmax - max message history day count
Method Detail

onTimer

public void onTimer()

getDestinationName

public java.lang.String getDestinationName()

getDestinationSubscription

public java.lang.String getDestinationSubscription()

isDestinationTopic

public boolean isDestinationTopic()

isDestinationDurable

public boolean isDestinationDurable()

getCount

public long getCount()
Gets the total message count since startup or last counter reset


getCountDelta

public long getCountDelta()
Gets the message count delta since last method call


getMessageCount

public int getMessageCount()
Gets the current message count of pending messages within the destination waiting for dispatch


getMessageCountDelta

public int getMessageCountDelta()
Gets the message count delta of pending messages since last method call.


getLastUpdate

public long getLastUpdate()

getLastAddedMessageTime

public long getLastAddedMessageTime()

resetCounter

public void resetCounter()

resetHistory

public void resetHistory()

getHistory

public java.util.List<MessageCounter.DayCounter> getHistory()

getHistoryAsString

public java.lang.String getHistoryAsString()
Get message counter history data as string in format "day count\n Date 1, hour counter 0, hour counter 1, ..., hour counter 23\n Date 2, hour counter 0, hour counter 1, ..., hour counter 23\n ..... ..... Date n, hour counter 0, hour counter 1, ..., hour counter 23\n"

Returns:
String message history data string

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2006 JBoss Inc. All Rights Reserved.