Package org.javasimon

Core package, contains Simon implementations, with the SimonManager as the center point of the API.

See: Description

Package org.javasimon Description

Core package, contains Simon implementations, with the SimonManager as the center point of the API.

Core package contains all basic interfaces (Simon, Counter, Stopwatch and Manager) with their implementations along with SimonManager that provides convenient access to the default Simon Manger.

There are two basic types of Simons provided:

All Simons share some basic functions - these are implemented in AbstractSimon. Simons are organized in the tree - methods Simon.getChildren() and Simon.getParent() can be used to traverse it along with SimonManager.getRootSimon(). This tree is also important to determine if the Simon is enabled or disabled. Disabled Simon has minimal possible overhead - but it does not count or measure anything. Simon's state is specified by Simon.setState(SimonState, boolean). SimonState enumeration has three values: SimonState.ENABLED sets Simon as enabled, SimonState.DISABLED sets Simon as disabled and SimonState.INHERIT lets Simon to inherit its state from the parent (recursively).

The whole SimonManager can be enabled or disabled - this is important difference from disabled Simons. Whenever SimonManager is disabled (SimonManager.disable()) any method returning Simon returns NullSimon. Null Simon is different from the disabled Simon because it does nothing and always returns zero/empty values if value is expected. Null Simon is always disabled and cannot be enabled. If the SimonManager is enabled again (SimonManager.enable()) it returns real Simons again. This leads to following recommendations:

Bottom line: If you want to use Simon, get it from SimonManager when needed and don not cache it. (Unless you know what you're doing.)

TODO: Configuration

Copyright © 2019. All rights reserved.