|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectde.is24.util.monitoring.InApplicationMonitor
public final class InApplicationMonitor
This is the central class of appmon4j.
appmon4j is a lightweight, easy to use in application monitoring system
allowing measurements of "real traffic" performance values
in high throughput java applications.
This class is an "old school" singleton, which is accessed by using
the static getInstance() method.
| Field Summary | |
|---|---|
private CorePlugin |
corePlugin
|
private static InApplicationMonitor |
INSTANCE
|
private KeyHandler |
keyHandler
|
private static org.apache.log4j.Logger |
LOGGER
|
private boolean |
monitorActive
|
private CopyOnWriteArrayList<MonitorPlugin> |
plugins
|
private static String |
semaphore
|
| Constructor Summary | |
|---|---|
protected |
InApplicationMonitor(CorePlugin corePlugin,
KeyHandler keyHandler)
|
| Method Summary | |
|---|---|
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. |
int |
getMaxHistoryEntriesToKeep()
Deprecated. use corePlugin directly, will be removed from InApplicationMonitor |
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)
|
protected static InApplicationMonitor |
initInstanceForTesting(CorePlugin corePlugin,
KeyHandler keyHandler)
This will fail if tests are run multi threaded use with utmost care. |
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 |
protected static void |
resetInstanceForTesting()
This will fail if tests are run multi threaded use with utmost care. |
void |
setMaxHistoryEntriesToKeep(int aMaxHistoryEntriesToKeep)
Deprecated. use corePlugin directly, will be removed from InApplicationMonitor |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final org.apache.log4j.Logger LOGGER
private static String semaphore
private static InApplicationMonitor INSTANCE
private volatile boolean monitorActive
private final CopyOnWriteArrayList<MonitorPlugin> plugins
private final CorePlugin corePlugin
private final KeyHandler keyHandler
| Constructor Detail |
|---|
protected InApplicationMonitor(CorePlugin corePlugin,
KeyHandler keyHandler)
| Method Detail |
|---|
protected static InApplicationMonitor initInstanceForTesting(CorePlugin corePlugin,
KeyHandler keyHandler)
protected static void resetInstanceForTesting()
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 keeppublic void addReportableObserver(ReportableObserver reportableObserver)
reportableObserver - the class that wants to be notifiedpublic void removeReportableObserver(ReportableObserver reportableObserver)
reportableObserver - 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 increment
public 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 initialized
public 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 measurement
public 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 measurement
public 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 measurement
public 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 add
public 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 List<String> getRegisteredPluginKeys()
public void removeAllPlugins()
public CorePlugin getCorePlugin()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||