|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.sensor.timer.Timer
Short-lived, non thread-safe input frontend class for working with timers.
This class is not thread-safe and for good reasons. The TimerData instance that
is nested inside each Timer instance is thread-safe and is shared between
many seperate instances of Timer. When the stop()
method is called, a
synchronized call to TimerData.updateStatistics(long)} will be made to
update the "real" timer. After that call, the instance of Timer can be safely
reused or garbage collected.
Method Summary | |
void |
addLabel(String label)
Adds the specified label to the set of labels associated with this instance. |
String |
getId()
Returns the id straight from the nested TimerData. |
boolean |
isRunning()
Is this Timer instance currently running (ie start() was called but
stop() was not called yet. |
Timer |
start()
Starts the timer. |
void |
stop()
Stops the timer and reports the time that passed since the first call to start() to the nested TimerData instance. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public void addLabel(String label)
label
- public String getId()
public Timer start()
start()
method has been called but the stop()
method has not yet been called. For convernience, this method returns the 'this'
reference.
public boolean isRunning()
start()
was called but
stop()
was not called yet.
public void stop()
start()
to the nested TimerData instance.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |