public final class RuntimeClock extends Object implements Clock
Clock.IdleHandler, Clock.RuntimeStartHandler, Clock.RuntimeStopHandler, Clock.StartHandler, Clock.StopHandler| Modifier and Type | Method and Description |
|---|---|
void |
close()
Wait for all client alarms to finish executing and gracefully shutdown the clock.
|
boolean |
isClosed()
The clock is closed after a call to stop() or close().
|
boolean |
isIdle()
Check if there are no client alarms scheduled.
|
void |
run()
Main event loop.
|
Time |
scheduleAlarm(int offset,
EventHandler<Alarm> handler)
Schedule a new Alarm event in `offset` milliseconds into the future,
and supply an event handler to be called at that time.
|
void |
stop()
Stop the clock.
|
void |
stop(Throwable exception)
Stop the clock on exception.
|
public Time scheduleAlarm(int offset, EventHandler<Alarm> handler)
scheduleAlarm in interface Clockoffset - Number of milliseconds into the future relative to current time.handler - Event handler to be invoked.IllegalStateException - if the clock is already closed.public void stop()
public void stop(Throwable exception)
public void close()
close in interface AutoCloseableclose in interface Clockpublic boolean isIdle()
public boolean isClosed()
Copyright © 2017 The Apache Software Foundation. All rights reserved.