mx4j.tools.stats
Class AbstractStatisticsRecorder

java.lang.Object
  extended bymx4j.tools.stats.AbstractStatisticsRecorder
All Implemented Interfaces:
javax.management.MBeanRegistration, StatisticsRecorderMBean
Direct Known Subclasses:
ObserverStatisticsRecorder, ValueStatisticsRecorder

public abstract class AbstractStatisticsRecorder
extends java.lang.Object
implements StatisticsRecorderMBean, javax.management.MBeanRegistration

Class AbstractStatisticsRecorder. Abstract Parent of the Stats collector classes. It implements some basic services

Version:
$Revision: 1.6 $
See Also:
StatisticsRecorderMBean

Field Summary
protected  double averageValue
           
protected  long count
           
protected  java.util.SortedMap entries
           
protected  boolean isActive
           
protected  boolean isDouble
           
protected  int maxEntries
           
protected  double maximumValue
           
protected  double minimumValue
           
protected  java.util.Date recordingStart
           
protected  javax.management.MBeanServer server
           
 
Constructor Summary
AbstractStatisticsRecorder()
           
 
Method Summary
protected  void addEntry(java.util.Date key, java.lang.Number value)
          Adds an entry to the collection.
protected  void doStart()
          Subclasses may override this to offer a custom startup procedure
protected  void doStop()
          Subclasses may override this to offer a custom stop procedure
 java.lang.Number getAverage()
          Returns the Average Value
 java.util.SortedMap getEntries()
          Returs a sorted map of the recorded values indexed by PointTime
protected  Logger getLogger()
           
 java.lang.Number getMax()
          Returns the Maximum Value
 int getMaxEntries()
          Returns how many entries may be recorded.
 java.lang.Number getMin()
          Returns the Minimum Value
 java.util.Date getRecordingStart()
          Returns the date when it started recording
 boolean isActive()
          Indicates whether the MBean is recording values
 void postDeregister()
           
 void postRegister(java.lang.Boolean registrationDone)
           
 void preDeregister()
           
 javax.management.ObjectName preRegister(javax.management.MBeanServer server, javax.management.ObjectName name)
           
 void setMaxEntries(int maxEntries)
          Sets the maximum entries stored in this recorder
 void start()
          Starts recording a variable
 void stop()
          Stops recording a variable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

isActive

protected boolean isActive

server

protected javax.management.MBeanServer server

maxEntries

protected int maxEntries

entries

protected java.util.SortedMap entries

recordingStart

protected java.util.Date recordingStart

isDouble

protected boolean isDouble

minimumValue

protected double minimumValue

maximumValue

protected double maximumValue

averageValue

protected double averageValue

count

protected long count
Constructor Detail

AbstractStatisticsRecorder

public AbstractStatisticsRecorder()
Method Detail

getLogger

protected Logger getLogger()

start

public void start()
Description copied from interface: StatisticsRecorderMBean
Starts recording a variable

Specified by:
start in interface StatisticsRecorderMBean

stop

public void stop()
Description copied from interface: StatisticsRecorderMBean
Stops recording a variable

Specified by:
stop in interface StatisticsRecorderMBean

getAverage

public java.lang.Number getAverage()
Description copied from interface: StatisticsRecorderMBean
Returns the Average Value

Specified by:
getAverage in interface StatisticsRecorderMBean

getMin

public java.lang.Number getMin()
Description copied from interface: StatisticsRecorderMBean
Returns the Minimum Value

Specified by:
getMin in interface StatisticsRecorderMBean

getMax

public java.lang.Number getMax()
Description copied from interface: StatisticsRecorderMBean
Returns the Maximum Value

Specified by:
getMax in interface StatisticsRecorderMBean

isActive

public boolean isActive()
Description copied from interface: StatisticsRecorderMBean
Indicates whether the MBean is recording values

Specified by:
isActive in interface StatisticsRecorderMBean

getMaxEntries

public int getMaxEntries()
Description copied from interface: StatisticsRecorderMBean
Returns how many entries may be recorded. When the maximum amount is reached the default behaviour is to forget the oldest one

Specified by:
getMaxEntries in interface StatisticsRecorderMBean

setMaxEntries

public void setMaxEntries(int maxEntries)
Description copied from interface: StatisticsRecorderMBean
Sets the maximum entries stored in this recorder

Specified by:
setMaxEntries in interface StatisticsRecorderMBean

getEntries

public java.util.SortedMap getEntries()
Description copied from interface: StatisticsRecorderMBean
Returs a sorted map of the recorded values indexed by PointTime

Specified by:
getEntries in interface StatisticsRecorderMBean

getRecordingStart

public java.util.Date getRecordingStart()
Description copied from interface: StatisticsRecorderMBean
Returns the date when it started recording

Specified by:
getRecordingStart in interface StatisticsRecorderMBean

preRegister

public javax.management.ObjectName preRegister(javax.management.MBeanServer server,
                                               javax.management.ObjectName name)
                                        throws java.lang.Exception
Specified by:
preRegister in interface javax.management.MBeanRegistration
Throws:
java.lang.Exception

postRegister

public void postRegister(java.lang.Boolean registrationDone)
Specified by:
postRegister in interface javax.management.MBeanRegistration

preDeregister

public void preDeregister()
                   throws java.lang.Exception
Specified by:
preDeregister in interface javax.management.MBeanRegistration
Throws:
java.lang.Exception

postDeregister

public void postDeregister()
Specified by:
postDeregister in interface javax.management.MBeanRegistration

doStart

protected void doStart()
                throws java.lang.Exception
Subclasses may override this to offer a custom startup procedure

Throws:
java.lang.Exception

doStop

protected void doStop()
               throws java.lang.Exception
Subclasses may override this to offer a custom stop procedure

Throws:
java.lang.Exception

addEntry

protected void addEntry(java.util.Date key,
                        java.lang.Number value)
Adds an entry to the collection. It also reduces the size if too big and updates the statics



Copyright © 2001-2005 The MX4J Contributors. All Rights Reserved.