public final class SimonManager extends Object
Manager
.
It is possible to create separate Manager, but it cannot be accessed via this convenient
utility-like class. This option may be useful in Java EE environment when it's required to
separate Simon trees across different applications. For majority of Java SE applications this
class is recommended.
SimonManager also provides configuration initialization via properties. To initialize configuration
with the configuration file following option can be added to JVM executable:
-Djavasimon.config.file=some-path/simon.config.xmlTo configure the SimonManager via resource that can be found on classpath:
-Djavasimon.config.resource=org/javasimon/example/wannabe-config.xml
Modifier and Type | Field and Description |
---|---|
static String |
PROPERTY_CONFIG_FILE_NAME
Property name for the Simon configuration file is "javasimon.config.file".
|
static String |
PROPERTY_CONFIG_RESOURCE_NAME
Property name for the Simon configuration resource is "javasimon.config.resource".
|
Modifier and Type | Method and Description |
---|---|
static CompositeCallback |
callback()
Accesses Simon callback.
|
static void |
clear()
Clears the SimonManager (ignored if manager is disabled).
|
static ManagerConfiguration |
configuration()
Accesses configuration of this manager.
|
static void |
destroySimon(String name)
Destroys Simon or replaces it with UnknownSimon if it's necessary to preserve the hierarchy.
|
static void |
disable()
Disables the Simon Manager.
|
static void |
enable()
Enables the Simon Manager.
|
static Counter |
getCounter(String name)
Returns existing Counter or creates new if necessary.
|
static Simon |
getRootSimon()
Returns root Simon.
|
static Simon |
getSimon(String name)
Returns Simon by its name if it exists.
|
static Collection<String> |
getSimonNames()
Returns unmodifiable collection containing names of all existing Simons.
|
static Collection<Simon> |
getSimons(SimonFilter simonFilter)
Returns collection containing all existing Simons accepted by specified
SimonFilter . |
static Stopwatch |
getStopwatch(String name)
Returns existing Stopwatch or creates new if necessary.
|
static boolean |
isEnabled()
Returns true if the Simon Manager is enabled.
|
static Manager |
manager()
Accesses default Simon Manager which is the switching manager.
|
static void |
message(String message)
Method propagates message to manager's
Callback . |
static void |
warning(String warning,
Exception cause)
Method propagates warning to manager's
Callback . |
public static final String PROPERTY_CONFIG_FILE_NAME
public static final String PROPERTY_CONFIG_RESOURCE_NAME
public static Simon getSimon(String name)
name
- name of the Simonpublic static void destroySimon(String name)
name
- name of the Simonpublic static Counter getCounter(String name)
name
- name of the Counterpublic static Stopwatch getStopwatch(String name)
name
- name of the Stopwatchpublic static void enable()
public static void disable()
public static boolean isEnabled()
public static Simon getRootSimon()
public static Collection<String> getSimonNames()
public static Collection<Simon> getSimons(SimonFilter simonFilter)
SimonFilter
.
If null
pattern is provided all Simons are returned in an unmodifiable Collection.
Otherwise new collection with matching Simons is returned.simonFilter
- filter accepting the Simons to result collectionto find out more about possible patterns
public static void clear()
public static CompositeCallback callback()
public static ManagerConfiguration configuration()
public static Manager manager()
public static void message(String message)
Callback
. This allows user to report any
message if they implement Callback.onManagerMessage(String)
.message
- message textpublic static void warning(String warning, Exception cause)
Callback
. This allows user to report any
warning and/or exception if they implement Callback.onManagerWarning(String, Exception)
.warning
- arbitrary warning messagecause
- exception causing this warningCopyright © 2019. All rights reserved.