|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.perf4j.TimedRunnable
public class TimedRunnable
This helper wrapper class can be used to add timing statements to an existing Runnable instance, logging how long it takes for the run method to execute. Note that instances of this class are only serializable if the wrapped Runnable is serializable.
Constructor Summary | |
---|---|
TimedRunnable(Runnable task,
LoggingStopWatch stopWatch)
Wraps the existing Runnable in order to time its run method. |
Method Summary | |
---|---|
LoggingStopWatch |
getStopWatch()
Gets the LoggingStopWatch that will be used to time the run method execution. |
Runnable |
getWrappedTask()
Gets the Runnable task that is wrapped by this TimedRunnable. |
void |
run()
Executes the run method of the underlying task, using the LoggingStopWatch to track the execution time. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TimedRunnable(Runnable task, LoggingStopWatch stopWatch)
task
- The existing Runnable whose run method is to be timed and executed. May not be null.stopWatch
- The LoggingStopWatch to use to time the run method execution. Note that this stop watch should
already have its tag and message set to what should be logged when the task is run. May not
be null.Method Detail |
---|
public Runnable getWrappedTask()
public LoggingStopWatch getStopWatch()
public void run()
run
in interface Runnable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |