|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.TimerTask
org.apache.commons.monitoring.reporting.AbstractPeriodicLogger
public abstract class AbstractPeriodicLogger
An helper class to build a periodic task that logs the monitored application state for a period.
Typical use of this class is to implement the log method to format the indicators and append the result for each period in a log file.
| Constructor Summary | |
|---|---|
AbstractPeriodicLogger(int period,
java.util.Date firstTime,
Repository.Observable repository)
Create and start a PeriodicLogger to observe and log the repository data. |
|
AbstractPeriodicLogger(int period,
Repository.Observable repository)
|
|
| Method Summary | |
|---|---|
protected SecondaryRepository |
getRepositoryForActivePeriod()
|
protected void |
handleError(java.lang.Throwable t)
Warn when logging the repository failed. |
protected abstract void |
log(SecondaryRepository period)
Log the data from the (secondary) repository generated during the period |
void |
run()
|
void |
stop()
|
| Methods inherited from class java.util.TimerTask |
|---|
cancel, scheduledExecutionTime |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AbstractPeriodicLogger(int period,
Repository.Observable repository)
period - the period (in ms) to log the monitoring staterepository - the observed repository
public AbstractPeriodicLogger(int period,
java.util.Date firstTime,
Repository.Observable repository)
period - the period (in ms) to log the monitoring statefirstTime - the first time to log the observed repository (may be null)repository - the observed repository| Method Detail |
|---|
public void stop()
public void run()
run in interface java.lang.Runnablerun in class java.util.TimerTaskTimerTask.run()protected void handleError(java.lang.Throwable t)
This method is expected to be override by user to avoid System.err outputs and use the application logging strategy.
t - error during logging
protected abstract void log(SecondaryRepository period)
throws java.io.IOException
period - secondary repository that observed the monitored state during the last active period
java.io.IOExceptionprotected SecondaryRepository getRepositoryForActivePeriod()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||