org.jboss.soa.esb.listeners.message
Class MessageCounter

java.lang.Object
  extended by org.jboss.mx.util.JBossNotificationBroadcasterSupport
      extended by org.jboss.system.ServiceMBeanSupport
          extended by org.jboss.soa.esb.listeners.message.MessageCounter
All Implemented Interfaces:
java.util.Observer, javax.management.MBeanRegistration, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, MessageCounterMBean, org.jboss.system.Service, org.jboss.system.ServiceMBean

public class MessageCounter
extends org.jboss.system.ServiceMBeanSupport
implements MessageCounterMBean, java.util.Observer

MessageCounter is a MBean implementation which keeps track of message data and metadata.

Author:
tcunning@redhat.com

Field Summary
 
Fields inherited from class org.jboss.system.ServiceMBeanSupport
log, server, SERVICE_CONTROLLER_SIG, serviceName
 
Fields inherited from interface org.jboss.system.ServiceMBean
CREATE_EVENT, CREATED, DESTROY_EVENT, DESTROYED, FAILED, REGISTERED, START_EVENT, STARTED, STARTING, states, STOP_EVENT, STOPPED, STOPPING, UNREGISTERED
 
Constructor Summary
MessageCounter()
          Constructor.
 
Method Summary
 java.lang.Double getAverageSuccessTime()
          Get the average time to process a message.
 int getFailedMessageCount()
          Get the total number of failed messages.
 java.lang.String getLastFailedMessageDate()
          Get the time the last message was processed at.
 java.lang.String getLastSuccessfulMessageDate()
          Get the time the last message was processed at.
 int getSuccessfulMessageCount()
          Get the total number of successfully processed messages.
 int getTotalMessageCount()
          Get the total number of processed messages, both successful and failed.
 void resetCounts()
          Reset the counts - this resets the totals and the last message time.
 void update(java.util.Observable o, java.lang.Object arg)
          Update the message counter based on the MessageStatusBean that is returned from the observable.
 
Methods inherited from class org.jboss.system.ServiceMBeanSupport
create, createService, destroy, destroyService, getDeploymentInfo, getLog, getName, getNextNotificationSequenceNumber, getObjectName, getServer, getServiceName, getState, getStateString, jbossInternalCreate, jbossInternalDescription, jbossInternalDestroy, jbossInternalLifecycle, jbossInternalStart, jbossInternalStop, postDeregister, postRegister, preDeregister, preRegister, start, startService, stop, stopService
 
Methods inherited from class org.jboss.mx.util.JBossNotificationBroadcasterSupport
addNotificationListener, getNotificationInfo, handleNotification, nextNotificationSequenceNumber, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.system.ServiceMBean
getName, getState, getStateString, jbossInternalLifecycle
 
Methods inherited from interface org.jboss.system.Service
create, destroy, start, stop
 

Constructor Detail

MessageCounter

public MessageCounter()
Constructor.

Method Detail

getFailedMessageCount

public int getFailedMessageCount()
Get the total number of failed messages.

Specified by:
getFailedMessageCount in interface MessageCounterMBean
Returns:
total number of failed messages

getLastSuccessfulMessageDate

public java.lang.String getLastSuccessfulMessageDate()
Get the time the last message was processed at.

Specified by:
getLastSuccessfulMessageDate in interface MessageCounterMBean
Returns:
time the last message was processed at

getLastFailedMessageDate

public java.lang.String getLastFailedMessageDate()
Get the time the last message was processed at.

Specified by:
getLastFailedMessageDate in interface MessageCounterMBean
Returns:
time the last message was processed at

getTotalMessageCount

public int getTotalMessageCount()
Get the total number of processed messages, both successful and failed.

Specified by:
getTotalMessageCount in interface MessageCounterMBean
Returns:
total number of processed messages

getSuccessfulMessageCount

public int getSuccessfulMessageCount()
Get the total number of successfully processed messages.

Specified by:
getSuccessfulMessageCount in interface MessageCounterMBean
Returns:
total number of successfully processed messages

update

public void update(java.util.Observable o,
                   java.lang.Object arg)
Update the message counter based on the MessageStatusBean that is returned from the observable.

Specified by:
update in interface java.util.Observer
Parameters:
o - the observable object
arg - the MessageStatusBean

getAverageSuccessTime

public java.lang.Double getAverageSuccessTime()
Get the average time to process a message.

Specified by:
getAverageSuccessTime in interface MessageCounterMBean
Returns:
average time to process a message

resetCounts

public void resetCounts()
Reset the counts - this resets the totals and the last message time.

Specified by:
resetCounts in interface MessageCounterMBean