|
JMACS | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jmacs.util.Timer
public class Timer
timer which defines a cycle--in terms of its period and some reference boundary--and which is able to sleep until the next boundary of that cycle. This is NOT thread safe.
Nested Class Summary | |
---|---|
static class |
Timer.Params
immutable parameters. |
Constructor Summary | |
---|---|
Timer()
creates new instance. |
|
Timer(long refBoundaryMillis,
long periodMillis)
creates new instance. |
|
Timer(Timer.Params params)
creates new instance. |
Method Summary | |
---|---|
long |
getLagMillis()
returns this property. |
long |
getLastBoundaryMillis()
in case sleep not called. |
Timer.Params |
getParams()
returns parameters. |
long |
getPeriodMillis()
returns period/ms. |
void |
setLagMillis(long lagMillis)
where (current time + lagMillis) is used in place of the value obtained from the system clock. |
void |
setParams(long refBoundaryMillis,
long periodMillis)
sets parameters. |
void |
setParams(Timer.Params params)
sets parameters. |
void |
setPeriodMillis(long periodMillis)
sets new period/ms. |
void |
setRefBoundaryMillis(long refBoundaryMillis)
sets new reference boundary/ms. |
long |
sleep()
until the next boundary. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Timer()
public Timer(long refBoundaryMillis, long periodMillis)
public Timer(Timer.Params params)
Method Detail |
---|
public long sleep() throws InterruptedException
InterruptedException
public long getLastBoundaryMillis()
public long getPeriodMillis()
public Timer.Params getParams()
public void setRefBoundaryMillis(long refBoundaryMillis)
public void setPeriodMillis(long periodMillis)
public void setParams(long refBoundaryMillis, long periodMillis)
public void setParams(Timer.Params params)
public void setLagMillis(long lagMillis)
public long getLagMillis()
|
JMACS | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |