public class InApplicationMonitor extends Object
| Modifier and Type | Field and Description |
|---|---|
private CorePlugin |
corePlugin |
protected static InApplicationMonitor |
INSTANCE |
private KeyHandler |
keyHandler |
private static org.apache.log4j.Logger |
LOGGER |
private boolean |
monitorActive |
private CopyOnWriteArrayList<MonitorPlugin> |
plugins |
protected static Object |
semaphore |
| Modifier | Constructor and Description |
|---|---|
protected |
InApplicationMonitor(CorePlugin corePlugin,
KeyHandler keyHandler) |
| Modifier and Type | Method and Description |
|---|---|
void |
activate() |
void |
addHighRateTimerMeasurement(String name,
long timing)
Add a timer measurement for a often occuring event with given name.
|
void |
addHistorizable(Historizable historizable)
add a
Historizable instance to the list identified by historizable.getName() |
void |
addReportableObserver(ReportableObserver reportableObserver)
Deprecated.
use corePlugin directly, will be removed from InApplicationMonitor
|
void |
addSingleEventTimerMeasurement(String name,
long timing)
Add a timer measurement for a rarely occuring event with given name.
|
void |
addTimerMeasurement(String name,
long timing)
Add a timer measurement for the given name.
|
void |
addTimerMeasurement(String name,
long begin,
long end)
Add a timer measurement for the given name.
|
void |
deactivate() |
CorePlugin |
getCorePlugin() |
static InApplicationMonitor |
getInstance()
Delivers the Singleton instance of InApplicationMonitor.
|
protected KeyHandler |
getKeyHandler() |
int |
getMaxHistoryEntriesToKeep()
Deprecated.
use corePlugin directly, will be removed from InApplicationMonitor
|
protected List<MonitorPlugin> |
getPlugins() |
List<String> |
getRegisteredPluginKeys() |
void |
incrementCounter(String name)
Increment the named
Counter by one. |
void |
incrementCounter(String name,
int increment)
Increase the specified counter by a variable amount.
|
void |
incrementHighRateCounter(String name)
Increment the named
Counter by one. |
void |
initializeCounter(String name)
If you want to ensure existance of a counter, for example you want to prevent
spelling errors in an operational monitoring configuration, you may initialize a counter
using this method.
|
void |
initializeTimerMeasurement(String name)
If you want to ensure existence of a timer, for example you want to prevent
spelling errors in an operational monitoring configuration, you may initialize a timer
using this method.
|
static InApplicationMonitor |
initInstance(CorePlugin corePlugin,
KeyHandler keyHandler) |
boolean |
isMonitorActive()
If true, monitoring is active.
|
void |
registerPlugin(MonitorPlugin plugin)
Register a plugin to able to hook into monitoring with your own monitor.
|
void |
registerStateValue(StateValueProvider stateValueProvider)
Add a state value provider to this appmon4j instance.
|
void |
registerVersion(String name,
String version)
This method was intended to register module names with their
current version identifier.
|
void |
removeAllPlugins() |
void |
removeReportableObserver(ReportableObserver reportableObserver)
Deprecated.
use corePlugin directly, will be removed from InApplicationMonitor
|
void |
reportInto(ReportVisitor reportVisitor)
Deprecated.
use corePlugin directly, will be removed from InApplicationMonitor
|
void |
resetThreadLocalState() |
void |
setMaxHistoryEntriesToKeep(int aMaxHistoryEntriesToKeep)
Deprecated.
use corePlugin directly, will be removed from InApplicationMonitor
|
void |
setThreadLocalState() |
private static final org.apache.log4j.Logger LOGGER
protected static final Object semaphore
private volatile boolean monitorActive
private final CopyOnWriteArrayList<MonitorPlugin> plugins
private volatile KeyHandler keyHandler
private volatile CorePlugin corePlugin
protected static InApplicationMonitor INSTANCE
protected InApplicationMonitor(CorePlugin corePlugin, KeyHandler keyHandler)
public static InApplicationMonitor getInstance()
public static InApplicationMonitor initInstance(CorePlugin corePlugin, KeyHandler keyHandler)
public void activate()
isMonitorActive()public void deactivate()
isMonitorActive()public boolean isMonitorActive()
@Deprecated public int getMaxHistoryEntriesToKeep()
@Deprecated public void setMaxHistoryEntriesToKeep(int aMaxHistoryEntriesToKeep)
aMaxHistoryEntriesToKeep - Number of entries to keep@Deprecated public void addReportableObserver(ReportableObserver reportableObserver)
reportableObserver - the class that wants to be notified@Deprecated public void removeReportableObserver(ReportableObserver reportableObserver)
reportableObserver - @Deprecated public void reportInto(ReportVisitor reportVisitor)
InApplicationMonitor side of the Visitor pattern.
Iterates through all registered Reportable instances and calls
the corresponding method on the ReportVisitor implementation.reportVisitor - The ReportVisitor instance that shall be visited
by all regieteres Reportable instances.public void incrementCounter(String name)
Counter by one.name - name of the Counter to incrementpublic void incrementHighRateCounter(String name)
Counter by one.
Using this method instead of incrementCounter is a hint to some plugins
that this is an event that may happen very often. Plugins may use sampling to
to limit load or network traffic.name - name of the Counter to incrementpublic void incrementCounter(String name, int increment)
Increase the specified counter by a variable amount.
name - the name of the Counter to increaseincrement - the added to addpublic void initializeCounter(String name)
name - the name of the counter to be initializedpublic void addTimerMeasurement(String name, long timing)
Timers allow adding timer measurements, implicitly incrementing the count
Timers count and measure timed events.
The application decides which unit to use for timing.
Miliseconds are suggested and some ReportVisitor implementations
may imply this.name - name of the Timertiming - number of elapsed time units for a single measurementpublic void addSingleEventTimerMeasurement(String name, long timing)
Timers allow adding timer measurements, implicitly incrementing the count
Timers count and measure timed events.
The application decides which unit to use for timing.
Miliseconds are suggested and some ReportVisitor implementations
may imply this.name - name of the Timertiming - number of elapsed time units for a single measurementpublic void addHighRateTimerMeasurement(String name, long timing)
Timers allow adding timer measurements, implicitly incrementing the count
Timers count and measure timed events.
The application decides which unit to use for timing.
Miliseconds are suggested and some ReportVisitor implementations
may imply this.name - name of the Timertiming - number of elapsed time units for a single measurementpublic void addTimerMeasurement(String name, long begin, long end)
Timers allow adding timer measurements, implicitly incrementing the count
Timers count and measure timed events.
The application decides which unit to use for timing.
Miliseconds are suggested and some ReportVisitor implementations
may imply this.name - name of the Timerbegin - number of elapsed time units at the beginning of the single measurementend - number of elapsed time units at the end of the single measurementpublic void initializeTimerMeasurement(String name)
name - the name of the timer to be initializedpublic void registerStateValue(StateValueProvider stateValueProvider)
StateValueProvider instances allow access to a numeric
value (long), that is already available in the application.stateValueProvider - the StateValueProvider instance to addpublic void registerVersion(String name, String version)
name - name of the versionized "thing" (class, module etc.)version - identifier of the versionpublic void addHistorizable(Historizable historizable)
Historizable instance to the list identified by historizable.getName()historizable - the historizable to addpublic void registerPlugin(MonitorPlugin plugin)
plugin - the plugin to adapt a new monitor.public void removeAllPlugins()
protected KeyHandler getKeyHandler()
protected List<MonitorPlugin> getPlugins()
public CorePlugin getCorePlugin()
public void setThreadLocalState()
public void resetThreadLocalState()
Copyright © 2013 Immobilien Scout GmbH. All Rights Reserved.