|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.erights.e.extern.timer.Timer
Untamed: The master control object for timers and clocks.
Conceptually, there's one ephemeral (non-persistent) Timer per vat, but actually there's just one per JVM, where each delayed event remembers which vat it came from, and, when its time comes due, queues that event on that vat. Conceptually, when a vat is shut down, its per-vat-Timer is destroyed with it, freeing all its delayed events. Actually, nothing in the per-jvm-Timer is effected by a vat shutdown, but when these events come due, the attempt to queue them on their originating (and now, shut down) vat will silently fail.
If you build a virtual persistent Timer on top of the ephemeral Timer +
org.erights.e.extern.persist.SturdyRefMaker#onRevival
, be sure to
cancel the onRevival when the timer event is received, not when it is
sent. If you cancel the onRevival when the timer event is sent, and
if your vat checkpoints after it is sent and before its received, and if
your vat then revives from that checkpoint, then your event will be
undelivered and lost. To do the cancellation on reception, your
virtualization should wrap the real event with a persistent cancelling
event.
Field Summary | |
private TimerThread |
myThread
Our timer thread |
private static Timer |
TheTimer
The single permitted instance of this class |
Constructor Summary | |
private |
Timer()
Private constructor. |
Method Summary | |
void |
__printOn(TextWriter out)
Enabled: |
Clock |
every(long resolution,
TickReactor target)
Enabled: Creates a new clock. |
long |
now()
Enabled: The current time in absolute millis |
static Timer |
theTimer()
Enabled: XXX Return the single permitted Timer object. |
Timeout |
whenAlarm(long absMillis,
Runnable target)
Enabled: Sets an alarm to occur after the specified time, unless cancelled. |
Ref |
whenPast(long absMillis,
Object target,
String verb,
Object[] args)
Enabled: When the current time is >= absMillis, evaluate target <- verb(args...). |
Ref |
whenPast(long absMillis,
Thunk target)
Enabled: Sets a timeout to occur after the specified time. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final Timer TheTimer
private TimerThread myThread
Constructor Detail |
private Timer()
Method Detail |
public long now()
public Timeout whenAlarm(long absMillis, Runnable target)
After the alarm expires, target is eventually sent the run() message.
absMillis
- When should the alarm go off?target
- Object to be informed when the time comes
public Ref whenPast(long absMillis, Object target, String verb, Object[] args)
Remembers the
SendingContext
info.
public Ref whenPast(long absMillis, Thunk target)
After the timer expires, target is eventually sent the run() message.
absMillis
- When to time outtarget
- A thunk to be informed when the time comes
public Clock every(long resolution, TickReactor target)
resolution
- The clock tick intervaltarget
- Object to be sent tick notifications
org.erights.e.extern.timer.TickReactor
public void __printOn(TextWriter out) throws IOException
IOException
public static Timer theTimer()
There shouldn't be a single one.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |