org.javasimon.jmx
Class AbstractSimonMXBeanImpl

java.lang.Object
  extended by org.javasimon.jmx.AbstractSimonMXBeanImpl
All Implemented Interfaces:
SimonSuperMXBean
Direct Known Subclasses:
CounterMXBeanImpl, StopwatchMXBeanImpl

public abstract class AbstractSimonMXBeanImpl
extends Object
implements SimonSuperMXBean

Common functionality for JMX bean for a signle Simon that corresponds to AbstractSimon in the core package.

Author:
Richard "Virgo" Richter

Constructor Summary
AbstractSimonMXBeanImpl()
           
 
Method Summary
 long getFirstUsage()
          Returns ms timestamp of the first usage of this Simon.
 String getFirstUsageAsString()
          Returns nicely formatted timestamp of the first usage of this Simon.
 List<String> getChildrenNames()
          Returns list of children names.
 long getLastUsage()
          Returns ms timestamp of the last usage of this Simon.
 String getLastUsageAsString()
          Returns nicely formatted timestamp of the last usage of this Simon.
 String getName()
          Returns Simon name.
 String getNote()
          Returns note for the Simon.
 String getParentName()
          Returns name of the parent Simon.
 String getState()
          Returns state of the Simon that can be ENABLED, DISABLED or INHERITED.
 boolean isEnabled()
          Returns true, if the Simon is enabled or if the enabled state is inherited.
 void reset()
          Resets the Simon, its usages and stat processor - concrete values depend on the type and the implementation.
 void setNote(String note)
          Sets note for the Simon.
 void setState(String state, boolean overrule)
          Sets the state of the Simon.
protected abstract  Simon simon()
          Returns the wrapped Simon.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.javasimon.jmx.SimonSuperMXBean
getType, sample, sampleAndReset
 

Constructor Detail

AbstractSimonMXBeanImpl

public AbstractSimonMXBeanImpl()
Method Detail

getName

public final String getName()
Description copied from interface: SimonSuperMXBean
Returns Simon name. While Simon names can be null for anonymous Simons, such Simons are never registered hence this method never returns null.

Specified by:
getName in interface SimonSuperMXBean
Returns:
name of the Simon

getParentName

public final String getParentName()
Description copied from interface: SimonSuperMXBean
Returns name of the parent Simon.

Specified by:
getParentName in interface SimonSuperMXBean
Returns:
name of the parent Simon

getChildrenNames

public final List<String> getChildrenNames()
Description copied from interface: SimonSuperMXBean
Returns list of children names.

Specified by:
getChildrenNames in interface SimonSuperMXBean
Returns:
list of children names

getState

public final String getState()
Description copied from interface: SimonSuperMXBean
Returns state of the Simon that can be ENABLED, DISABLED or INHERITED. State is returned as a String that matches values of the SimonState enumeration.

Specified by:
getState in interface SimonSuperMXBean
Returns:
state of the Simon as a String

setState

public final void setState(String state,
                           boolean overrule)
Description copied from interface: SimonSuperMXBean
Sets the state of the Simon. It must be specified whether to propagate the change and overrule states of all sub-simons which effectively sets the same state to the whole subtree. If subtree is not overruled, some Simons (with their subtrees) may not be affected by this change.

Specified by:
setState in interface SimonSuperMXBean
Parameters:
state - a new state as a valid String for SimonState.valueOf(String)
overrule - specifies whether this change is forced to the whole subtree.

isEnabled

public final boolean isEnabled()
Description copied from interface: SimonSuperMXBean
Returns true, if the Simon is enabled or if the enabled state is inherited.

Specified by:
isEnabled in interface SimonSuperMXBean
Returns:
true, if the Simon is effectively enabled

reset

public final void reset()
Description copied from interface: SimonSuperMXBean
Resets the Simon, its usages and stat processor - concrete values depend on the type and the implementation.

Specified by:
reset in interface SimonSuperMXBean

getNote

public final String getNote()
Description copied from interface: SimonSuperMXBean
Returns note for the Simon. Note enables Simon with an additional information in human readable form.

Specified by:
getNote in interface SimonSuperMXBean
Returns:
note for the Simon.

setNote

public final void setNote(String note)
Description copied from interface: SimonSuperMXBean
Sets note for the Simon. Note enables Simon with an additional information in human readable form.

Specified by:
setNote in interface SimonSuperMXBean
Parameters:
note - note for the Simon.

getFirstUsage

public final long getFirstUsage()
Description copied from interface: SimonSuperMXBean
Returns ms timestamp of the first usage of this Simon. First and last usage are updated when monitor performs the measuring (start/stop/count/etc). They are not updated when values are obtained from the monitor.

Specified by:
getFirstUsage in interface SimonSuperMXBean
Returns:
ms timestamp of the first usage

getFirstUsageAsString

public String getFirstUsageAsString()
Description copied from interface: SimonSuperMXBean
Returns nicely formatted timestamp of the first usage of this Simon.

Specified by:
getFirstUsageAsString in interface SimonSuperMXBean
Returns:
formatted date and time of the first usage

getLastUsage

public final long getLastUsage()
Description copied from interface: SimonSuperMXBean
Returns ms timestamp of the last usage of this Simon. First and last usage are updated when monitor performs the measuring (start/stop/count/etc). They are not updated when values are obtained from the monitor.

Specified by:
getLastUsage in interface SimonSuperMXBean
Returns:
ms timestamp of the last usage

getLastUsageAsString

public final String getLastUsageAsString()
Description copied from interface: SimonSuperMXBean
Returns nicely formatted timestamp of the last usage of this Simon.

Specified by:
getLastUsageAsString in interface SimonSuperMXBean
Returns:
formatted date and time of the last usage

simon

protected abstract Simon simon()
Returns the wrapped Simon.

Returns:
wrapped Simon


Copyright © 2013. All Rights Reserved.