org.javasimon.jmx
Class SimonManagerMXBeanImpl

java.lang.Object
  extended by org.javasimon.jmx.SimonManagerMXBeanImpl
All Implemented Interfaces:
SimonManagerMXBean

public class SimonManagerMXBeanImpl
extends Object
implements SimonManagerMXBean

Simon MXBean implementation. See SimonManagerMXBean for interface documentation. Most methods are implemented by calling the Manager.

Since:
2.0
Author:
Radovan Sninsky
See Also:
Manager, Simon, SimonUtils

Field Summary
private  Manager manager
           
 
Constructor Summary
SimonManagerMXBeanImpl(Manager manager)
          MXBean constructor.
 
Method Summary
 void clearManager()
          Clears the Manager (ignored if manager is disabled).
 void disable()
          Disables the Simon Manager, disable monitoring application by Simons.
 void disableSimon(String name)
          Disables particular Simon only.
 void enable()
          Enables the Simon Manager, enable monitoring application by Simons.
 void enableSimon(String name)
          Enables particular Simon only.
 CounterSample getCounterSample(String name)
          Retrieves sample data object for a particular Counter.
 CounterSample getCounterSampleAndReset(String name)
          Retrieves sample data object for a particular Counter and resets it.
 List<CounterSample> getCounterSamples()
          Sample all Counters
 List<CounterSample> getCounterSamples(String namePattern)
          Sample all Counters whose name matches given pattern
 SimonInfo[] getSimonInfos()
          Returns array containing names and types of all existing Simons ordered naturally by name.
 String[] getSimonNames()
          Returns array containing full hierarchical names of all existing Simons.
 String[] getSimonNamesOrdered()
          Returns array containing full hierarchical names of all existing Simons in natural String order.
 StopwatchSample getStopwatchSample(String name)
          Retrieves sample data object for a particular Stopwatch.
 StopwatchSample getStopwatchSampleAndReset(String name)
          Retrieves sample data object for a particular Stopwatch and resets it.
 List<StopwatchSample> getStopwatchSamples()
          Sample all Stopwaches.
 List<StopwatchSample> getStopwatchSamples(String namePattern)
          Sample all Stopwaches whose name matches given pattern.
 String getType(String name)
          Returns type of Simon, either COUNTER, STOPWATCH or UNKNOWN.
 void inheritState(String name)
          Lets the Simon to inherit its enable/disable state from its parent.
 boolean isEnabled()
          Returns true if the Simon Manager is enabled, if monitoring is enabled.
 void printSimonTree()
          Prints multi-line string containing Simon tree starting with the specified Simon to standard output.
 void reset(String name)
          Resets the particular Simon by its name.
private  CounterSample sampleCounter(Simon s)
          Create a JMX Counter Sample from a Sample
private  StopwatchSample sampleStopwatch(Simon s)
          Create a JMX Stopwatch Sample from a Stopwatch
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

manager

private Manager manager
Constructor Detail

SimonManagerMXBeanImpl

public SimonManagerMXBeanImpl(Manager manager)
MXBean constructor.

Parameters:
manager - instance of Manager, typically SimonManager.manager().
Method Detail

enable

public final void enable()
Description copied from interface: SimonManagerMXBean
Enables the Simon Manager, enable monitoring application by Simons.

Specified by:
enable in interface SimonManagerMXBean
See Also:
Manager.enable()

disable

public final void disable()
Description copied from interface: SimonManagerMXBean
Disables the Simon Manager, disable monitoring application by Simons.

Specified by:
disable in interface SimonManagerMXBean
See Also:
Manager.disable()

isEnabled

public final boolean isEnabled()
Description copied from interface: SimonManagerMXBean
Returns true if the Simon Manager is enabled, if monitoring is enabled.

Specified by:
isEnabled in interface SimonManagerMXBean
Returns:
true if the Simon Manager is enabled
See Also:
Manager.isEnabled()

getSimonNames

public final String[] getSimonNames()
Description copied from interface: SimonManagerMXBean
Returns array containing full hierarchical names of all existing Simons.

Specified by:
getSimonNames in interface SimonManagerMXBean
Returns:
array of all Simon names
See Also:
Manager.getSimonNames()

getSimonNamesOrdered

public final String[] getSimonNamesOrdered()
Description copied from interface: SimonManagerMXBean
Returns array containing full hierarchical names of all existing Simons in natural String order.

Specified by:
getSimonNamesOrdered in interface SimonManagerMXBean
Returns:
array of all Simon names (ordered)
See Also:
Manager.getSimonNames()

getType

public final String getType(String name)
Description copied from interface: SimonManagerMXBean
Returns type of Simon, either COUNTER, STOPWATCH or UNKNOWN.

Specified by:
getType in interface SimonManagerMXBean
Parameters:
name - name of Simon
Returns:
string COUNTER if Counter Simon, STOPWATCH if Stopwatch Simon or UKNOWN if there is no Simon just undefined hierarchy node

getSimonInfos

public final SimonInfo[] getSimonInfos()
Description copied from interface: SimonManagerMXBean
Returns array containing names and types of all existing Simons ordered naturally by name.

Specified by:
getSimonInfos in interface SimonManagerMXBean
Returns:
array of SimonInfo objects

clearManager

public final void clearManager()
Description copied from interface: SimonManagerMXBean
Clears the Manager (ignored if manager is disabled). All Simons are lost, but the configuration is preserved.

Specified by:
clearManager in interface SimonManagerMXBean
See Also:
Manager.clear()

enableSimon

public final void enableSimon(String name)
Description copied from interface: SimonManagerMXBean
Enables particular Simon only.

Specified by:
enableSimon in interface SimonManagerMXBean
Parameters:
name - name of the Simon
See Also:
Simon.setState(org.javasimon.SimonState, boolean)

disableSimon

public final void disableSimon(String name)
Description copied from interface: SimonManagerMXBean
Disables particular Simon only.

Specified by:
disableSimon in interface SimonManagerMXBean
Parameters:
name - name of the Simon
See Also:
Simon.setState(org.javasimon.SimonState, boolean)

inheritState

public final void inheritState(String name)
Description copied from interface: SimonManagerMXBean
Lets the Simon to inherit its enable/disable state from its parent.

Specified by:
inheritState in interface SimonManagerMXBean
Parameters:
name - name of the Simon

sampleCounter

private CounterSample sampleCounter(Simon s)
Create a JMX Counter Sample from a Sample

Parameters:
s - Counter

getCounterSample

public final CounterSample getCounterSample(String name)
Description copied from interface: SimonManagerMXBean
Retrieves sample data object for a particular Counter.

Specified by:
getCounterSample in interface SimonManagerMXBean
Parameters:
name - name of the Simon
Returns:
sample object or null if Simon with entered name doesn't exist
See Also:
CounterSample

getCounterSampleAndReset

public final CounterSample getCounterSampleAndReset(String name)
Description copied from interface: SimonManagerMXBean
Retrieves sample data object for a particular Counter and resets it.

Specified by:
getCounterSampleAndReset in interface SimonManagerMXBean
Parameters:
name - name of the Simon
Returns:
sample object or null if Simon with entered name doesn't exist
See Also:
CounterSample

getCounterSamples

public List<CounterSample> getCounterSamples(String namePattern)
Sample all Counters whose name matches given pattern

Specified by:
getCounterSamples in interface SimonManagerMXBean
Parameters:
namePattern - Name pattern, null means all Counters
Returns:
One Sample for each Counter

getCounterSamples

public List<CounterSample> getCounterSamples()
Sample all Counters

Specified by:
getCounterSamples in interface SimonManagerMXBean
Returns:
One Sample for each Counter

sampleStopwatch

private StopwatchSample sampleStopwatch(Simon s)
Create a JMX Stopwatch Sample from a Stopwatch

Parameters:
s - Stopwatch

getStopwatchSample

public final StopwatchSample getStopwatchSample(String name)
Description copied from interface: SimonManagerMXBean
Retrieves sample data object for a particular Stopwatch.

Specified by:
getStopwatchSample in interface SimonManagerMXBean
Parameters:
name - name of the Simon
Returns:
sample object or null if Simon with entered name doesn't exist
See Also:
StopwatchSample

getStopwatchSampleAndReset

public final StopwatchSample getStopwatchSampleAndReset(String name)
Description copied from interface: SimonManagerMXBean
Retrieves sample data object for a particular Stopwatch and resets it.

Specified by:
getStopwatchSampleAndReset in interface SimonManagerMXBean
Parameters:
name - name of the Simon
Returns:
sample object or null if Simon with entered name doesn't exist
See Also:
StopwatchSample

getStopwatchSamples

public List<StopwatchSample> getStopwatchSamples(String namePattern)
Description copied from interface: SimonManagerMXBean
Sample all Stopwaches whose name matches given pattern.

Specified by:
getStopwatchSamples in interface SimonManagerMXBean
Parameters:
namePattern - name pattern (SimonPattern), null means all Stopwatches
Returns:
one Sample for each Stopwatch

getStopwatchSamples

public List<StopwatchSample> getStopwatchSamples()
Description copied from interface: SimonManagerMXBean
Sample all Stopwaches.

Specified by:
getStopwatchSamples in interface SimonManagerMXBean
Returns:
one Sample for each Stopwatch

printSimonTree

public final void printSimonTree()
Description copied from interface: SimonManagerMXBean
Prints multi-line string containing Simon tree starting with the specified Simon to standard output.

Specified by:
printSimonTree in interface SimonManagerMXBean
See Also:
SimonUtils.simonTreeString(org.javasimon.Simon)

reset

public final void reset(String name)
Description copied from interface: SimonManagerMXBean
Resets the particular Simon by its name.

Specified by:
reset in interface SimonManagerMXBean
Parameters:
name - name of the Simon


Copyright © 2013. All Rights Reserved.