|
|||||||||
| 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 static Pattern |
KEY_ESCAPE_PATTERN
|
private static org.apache.log4j.Logger |
LOGGER
|
private boolean |
monitorActive
|
private CopyOnWriteArrayList<MonitorPlugin> |
plugins
|
| Constructor Summary | |
|---|---|
private |
InApplicationMonitor()
|
| 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()
|
private String |
escape(String name)
helper function that escapes a reportable's name so that it is JMX-compatible |
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. |
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 |
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 final Pattern KEY_ESCAPE_PATTERN
private static final InApplicationMonitor INSTANCE
private volatile boolean monitorActive
private CorePlugin corePlugin
private final CopyOnWriteArrayList<MonitorPlugin> plugins
| Constructor Detail |
|---|
private InApplicationMonitor()
| Method Detail |
|---|
public static InApplicationMonitor getInstance()
private String escape(String name)
name - the original name of the reportable
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 | ||||||||