com.jamonapi
Class Monitor

java.lang.Object
  extended by com.jamonapi.Monitor
Direct Known Subclasses:
MonitorComposite, NullMonitor

public abstract class Monitor
extends java.lang.Object

Used to interact with monitor objects. I would have preferred to make this an interface, but didn't do that as jamon 1.0 code would have broken. Live and learn


Field Summary
static java.lang.String ACTIVE
           
static java.lang.String AVG
           
static java.lang.String AVGACTIVE
           
static java.lang.String FIRSTACCESS
           
static java.lang.String HITS
           
static java.lang.String LASTACCESS
           
static java.lang.String LASTVALUE
           
static java.lang.String MAX
           
static java.lang.String MAXACTIVE
           
static java.lang.String MIN
           
static java.lang.String STDDEV
           
static java.lang.String TOTAL
           
static java.lang.String VALUE
          Used in call to addListener(...).
 
Method Summary
 Monitor add(double value)
          This method adds a value to the monitor (and aggegates statistics on it)
 void addListener(java.lang.String listenerTypeName, JAMonListener listener)
          Introduced as a way to add listeners that allows for lazy initialization saving a fair amount of memory.
 void disable()
          Disable the monitor.
 void enable()
          enable the monitor.
 double getActive()
           
 double getAvg()
           
 double getAvgActive()
           
 double getAvgGlobalActive()
          for low numbers this can be negative
 double getAvgPrimaryActive()
           
 java.util.Date getFirstAccess()
           
 double getHits()
           
 JAMonDetailValue getJAMonDetailRow()
           
 java.lang.String getLabel()
          Returns the label for the monitor
 java.util.Date getLastAccess()
           
 double getLastValue()
           
 ListenerType getListenerType(java.lang.String listenerType)
          pass in a valid listener type (min, max, value, maxactive) and get the ListenerType
 double getMax()
           
 double getMaxActive()
           
 double getMin()
           
 MonKey getMonKey()
          Return the label associated with this monitor.
 Range getRange()
          Return the Range object associated with this monitor.
 double getStdDev()
           
 double getTotal()
           
 java.lang.String getUnits()
          Returns the units for the monitor
 java.lang.Object getValue(java.lang.String key)
          Alternative method of getting the values in the 'get' methods like getHits(), getAvg() etc.
 boolean hasListener(java.lang.String listenerTypeName, java.lang.String listenerName)
          Introduced as a way to check for listeners that allows for lazy initialization saving a fair amount of memory.
 boolean hasListeners()
           
 boolean hasListeners(java.lang.String listenerTypeName)
          Returns true if this listenertype ('max', 'min', 'value', 'maxactive') has any listeners at all
 boolean isActivityTracking()
           
 boolean isEnabled()
          Is the monitor enabled.
 boolean isPrimary()
           
 void removeListener(java.lang.String listenerTypeName, java.lang.String listenerName)
          Introduced as a way to remove listeners that allows for lazy initialization saving a fair amount of memory.
 void reset()
          reset all values in the monitor to their defaults
 void setAccessStats(long now)
           
 void setActive(double value)
           
 void setActivityTracking(boolean trackActivity)
          FROM frequencydistimp
 void setFirstAccess(java.util.Date date)
           
 void setHits(double value)
           
 void setLastAccess(java.util.Date date)
           
 void setLastValue(double value)
           
 void setMax(double value)
           
 void setMaxActive(double value)
           
 void setMin(double value)
           
 void setPrimary(boolean isPrimary)
          Indicate that this a primary Monitor.
 void setTotal(double value)
           
 void setTotalActive(double value)
          Neeed to reset this to 0.0 to remove avg active numbers
 Monitor skip()
          decrement counters but don't add aggregate stats to monitor.
 Monitor start()
          Start a monitor.
 Monitor stop()
          Stop a monitor.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

VALUE

public static final java.lang.String VALUE
Used in call to addListener(...). i.e. addListener(Monitor.MAX, ...). Also used to return values from getObject(key). For example mon.getValue("max");

See Also:
Constant Field Values

LASTVALUE

public static final java.lang.String LASTVALUE
See Also:
Constant Field Values

MAX

public static final java.lang.String MAX
See Also:
Constant Field Values

MIN

public static final java.lang.String MIN
See Also:
Constant Field Values

MAXACTIVE

public static final java.lang.String MAXACTIVE
See Also:
Constant Field Values

TOTAL

public static final java.lang.String TOTAL
See Also:
Constant Field Values

AVG

public static final java.lang.String AVG
See Also:
Constant Field Values

HITS

public static final java.lang.String HITS
See Also:
Constant Field Values

STDDEV

public static final java.lang.String STDDEV
See Also:
Constant Field Values

FIRSTACCESS

public static final java.lang.String FIRSTACCESS
See Also:
Constant Field Values

LASTACCESS

public static final java.lang.String LASTACCESS
See Also:
Constant Field Values

ACTIVE

public static final java.lang.String ACTIVE
See Also:
Constant Field Values

AVGACTIVE

public static final java.lang.String AVGACTIVE
See Also:
Constant Field Values
Method Detail

getMonKey

public MonKey getMonKey()
Return the label associated with this monitor.


getLabel

public java.lang.String getLabel()
Returns the label for the monitor


getUnits

public java.lang.String getUnits()
Returns the units for the monitor


setAccessStats

public void setAccessStats(long now)

reset

public void reset()
reset all values in the monitor to their defaults


getTotal

public double getTotal()

setTotal

public void setTotal(double value)

getAvg

public double getAvg()

getMin

public double getMin()

setMin

public void setMin(double value)

getMax

public double getMax()

setMax

public void setMax(double value)

getHits

public double getHits()

setHits

public void setHits(double value)

getStdDev

public double getStdDev()

setFirstAccess

public void setFirstAccess(java.util.Date date)

getFirstAccess

public java.util.Date getFirstAccess()

setLastAccess

public void setLastAccess(java.util.Date date)

getLastAccess

public java.util.Date getLastAccess()

getLastValue

public double getLastValue()

setLastValue

public void setLastValue(double value)

disable

public void disable()
Disable the monitor. If a monitor is disabled all other calls to the monitor are noops.


enable

public void enable()
enable the monitor. If the monitor is enabled all other calls to the monitor have an action


isEnabled

public boolean isEnabled()
Is the monitor enabled.


getListenerType

public ListenerType getListenerType(java.lang.String listenerType)
pass in a valid listener type (min, max, value, maxactive) and get the ListenerType


hasListeners

public boolean hasListeners(java.lang.String listenerTypeName)
Returns true if this listenertype ('max', 'min', 'value', 'maxactive') has any listeners at all

Parameters:
listenerTypeName -
Returns:
boolean

addListener

public void addListener(java.lang.String listenerTypeName,
                        JAMonListener listener)
Introduced as a way to add listeners that allows for lazy initialization saving a fair amount of memory. Note a future enhancement would be to delete the Listeners object when all listeners are removed.

Since:
2.71

hasListener

public boolean hasListener(java.lang.String listenerTypeName,
                           java.lang.String listenerName)
Introduced as a way to check for listeners that allows for lazy initialization saving a fair amount of memory. Note a future enhancement would be to delete the Listeners object when all listeners are removed.

Since:
2.71

removeListener

public void removeListener(java.lang.String listenerTypeName,
                           java.lang.String listenerName)
Introduced as a way to remove listeners that allows for lazy initialization saving a fair amount of memory. Note a future enhancement would be to delete the Listeners object when all listeners are removed.

Since:
2.71

start

public Monitor start()
Start a monitor. This increments the active counter by one. Calling start is not required. If it is called stop should be called too.


skip

public Monitor skip()
decrement counters but don't add aggregate stats to monitor. have to also back out the totalactive figures.

Returns:
Monitor

stop

public Monitor stop()
Stop a monitor. The decrements the active counter by one. Calling stop is required if start is called.


add

public Monitor add(double value)
This method adds a value to the monitor (and aggegates statistics on it)


getRange

public Range getRange()
Return the Range object associated with this monitor. The range object is a compromise between saving all data or none


getActive

public double getActive()

setActive

public void setActive(double value)

getMaxActive

public double getMaxActive()

setMaxActive

public void setMaxActive(double value)

setTotalActive

public void setTotalActive(double value)
Neeed to reset this to 0.0 to remove avg active numbers


isPrimary

public boolean isPrimary()

setPrimary

public void setPrimary(boolean isPrimary)
Indicate that this a primary Monitor. See www.jamonapi.com for an explanation of primary monitors


hasListeners

public boolean hasListeners()

getValue

public java.lang.Object getValue(java.lang.String key)
Alternative method of getting the values in the 'get' methods like getHits(), getAvg() etc.


toString

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

setActivityTracking

public void setActivityTracking(boolean trackActivity)
FROM frequencydistimp


isActivityTracking

public boolean isActivityTracking()

getAvgActive

public double getAvgActive()

getAvgGlobalActive

public double getAvgGlobalActive()
for low numbers this can be negative


getAvgPrimaryActive

public double getAvgPrimaryActive()

getJAMonDetailRow

public JAMonDetailValue getJAMonDetailRow()