mx4j.tools.stats

Class AbstractStatisticsRecorder

Implemented Interfaces:
javax.management.MBeanRegistration, StatisticsRecorderMBean
Known Direct 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 SortedMap
entries
protected boolean
isActive
protected boolean
isDouble
protected int
maxEntries
protected double
maximumValue
protected double
minimumValue
protected Date
recordingStart
protected javax.management.MBeanServer
server

Method Summary

protected void
addEntry(Date key, 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
Number
getAverage()
Returns the Average Value
SortedMap
getEntries()
Returs a sorted map of the recorded values indexed by PointTime
protected Logger
getLogger()
Number
getMax()
Returns the Maximum Value
int
getMaxEntries()
Returns how many entries may be recorded.
Number
getMin()
Returns the Minimum Value
Date
getRecordingStart()
Returns the date when it started recording
boolean
isActive()
Indicates whether the MBean is recording values
void
postDeregister()
void
postRegister(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

Field Details

averageValue

protected double averageValue

count

protected long count

entries

protected SortedMap entries

isActive

protected boolean isActive

isDouble

protected boolean isDouble

maxEntries

protected int maxEntries

maximumValue

protected double maximumValue

minimumValue

protected double minimumValue

recordingStart

protected Date recordingStart

server

protected javax.management.MBeanServer server

Method Details

addEntry

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

doStart

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

doStop

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

getAverage

public Number getAverage()
Returns the Average Value
Specified by:
getAverage in interface StatisticsRecorderMBean

getEntries

public SortedMap getEntries()
Returs a sorted map of the recorded values indexed by PointTime
Specified by:
getEntries in interface StatisticsRecorderMBean

getLogger

protected Logger getLogger()

getMax

public Number getMax()
Returns the Maximum Value
Specified by:
getMax in interface StatisticsRecorderMBean

getMaxEntries

public int getMaxEntries()
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

getMin

public Number getMin()
Returns the Minimum Value
Specified by:
getMin in interface StatisticsRecorderMBean

getRecordingStart

public Date getRecordingStart()
Returns the date when it started recording
Specified by:
getRecordingStart in interface StatisticsRecorderMBean

isActive

public boolean isActive()
Indicates whether the MBean is recording values
Specified by:
isActive in interface StatisticsRecorderMBean

postDeregister

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

postRegister

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

preDeregister

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

preRegister

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

setMaxEntries

public void setMaxEntries(int maxEntries)
Sets the maximum entries stored in this recorder
Specified by:
setMaxEntries in interface StatisticsRecorderMBean

start

public void start()
Starts recording a variable
Specified by:
start in interface StatisticsRecorderMBean

stop

public void stop()
Stops recording a variable
Specified by:
stop in interface StatisticsRecorderMBean

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