public final class SwitchingManager extends Object implements Manager
Manager implementation that supports enable() and disable() and switches between
backing EnabledManager and DisabledManager accordingly.HIERARCHY_DELIMITER, ROOT_SIMON_NAMECPU, MILLIS_IN_SECOND, NANOS_IN_MILLIS, NANOS_IN_SECOND, SYSTEM| Constructor and Description |
|---|
SwitchingManager() |
| Modifier and Type | Method and Description |
|---|---|
CompositeCallback |
callback()
Accesses default composite callback of this manager.
|
void |
clear()
Clears the whole manager and starts again with a single newly created Root Simon.
|
ManagerConfiguration |
configuration()
Accesses configuration of this manager.
|
void |
destroySimon(String name)
Removes Simon from the Manager.
|
void |
disable()
Disables the Simon Manager.
|
void |
enable()
Enables the Simon Manager.
|
Counter |
getCounter(String name)
Returns existing Counter or creates new if necessary.
|
Simon |
getRootSimon()
Returns root Simon.
|
Simon |
getSimon(String name)
Returns Simon by its name if it exists.
|
Collection<String> |
getSimonNames()
Returns unmodifiable collection containing names of all existing Simons.
|
Collection<Simon> |
getSimons(SimonFilter simonFilter)
Returns collection containing all existing Simons accepted by specified
SimonFilter. |
Stopwatch |
getStopwatch(String name)
Returns existing Stopwatch or creates new if necessary.
|
boolean |
isEnabled()
Returns true if the Java Simon API is enabled.
|
void |
message(String message)
Method propagates message to manager's
Callback. |
long |
millisForNano(long nanos)
Converts nano timer value into millis timestamp compatible with
SimonClock.milliTime() without actually
using the timer. |
long |
milliTime()
Gets current time in milliseconds.
|
long |
nanoTime()
Gets current time in nanoseconds.
|
void |
warning(String warning,
Exception cause)
Method propagates warning to manager's
Callback. |
public SwitchingManager()
public Simon getRootSimon()
ManagergetRootSimon in interface Managerpublic Simon getSimon(String name)
Managerpublic Counter getCounter(String name)
ManagergetCounter in interface Managername - name of the Counterpublic Stopwatch getStopwatch(String name)
ManagergetStopwatch in interface Managername - name of the Stopwatchpublic Collection<String> getSimonNames()
ManagergetSimonNames in interface Managerpublic Collection<Simon> getSimons(SimonFilter simonFilter)
ManagerSimonFilter.
If null filter is provided all Simons are returned in an unmodifiable Collection.
Otherwise new collection with matching Simons is returned.getSimons in interface ManagersimonFilter - filter accepting the Simons to result collectionto find out more about possible patternspublic void destroySimon(String name)
ManagerdestroySimon in interface Managername - name of the Simonpublic void clear()
Managerpublic CompositeCallback callback()
Managerpublic ManagerConfiguration configuration()
Managerconfiguration in interface Managerpublic void enable()
public void disable()
public boolean isEnabled()
public void message(String message)
ManagerCallback. This allows user to report any
message if they implement Callback.onManagerMessage(String).public void warning(String warning, Exception cause)
ManagerCallback. This allows user to report any
warning and/or exception if they implement Callback.onManagerWarning(String, Exception).public long milliTime()
SimonClockmilliTime in interface SimonClockpublic long nanoTime()
SimonClocknanoTime in interface SimonClockpublic long millisForNano(long nanos)
SimonClockSimonClock.milliTime() without actually
using the timer. Method does not just divide nanos by one million, but also works with remembered
values for milli- and nano-timers at one particular moment.millisForNano in interface SimonClocknanos - nano timer valueCopyright © 2019. All rights reserved.