@DefaultImplementation(value=RuntimeClock.class) public interface Clock extends Runnable, AutoCloseable
Modifier and Type | Interface and Description |
---|---|
static class |
Clock.IdleHandler
Bind this to an event handler to statically subscribe to the IdleClock Event.
|
static class |
Clock.RuntimeStartHandler
Bind this to an event handler to statically subscribe to the RuntimeStart Event.
|
static class |
Clock.RuntimeStopHandler
Bind this to an event handler to statically subscribe to the RuntimeStart Event.
|
static class |
Clock.StartHandler
Bind this to an event handler to statically subscribe to the StartTime Event.
|
static class |
Clock.StopHandler
Bind this to an event handler to statically subscribe to the StopTime Event.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
This will stop the clock after all client alarms
finish executing.
|
boolean |
isClosed()
Clock is closed after a call to stop() or close().
|
boolean |
isIdle()
Clock is idle if it has no future Alarms set.
|
Time |
scheduleAlarm(int offset,
EventHandler<Alarm> handler)
Schedule a TimerEvent at the given future offset.
|
void |
stop()
This stops the clock immediately, without waiting for
client alarms to finish.
|
void |
stop(Throwable exception)
This stops the clock immediately, without waiting for
client alarms to finish.
|
Time scheduleAlarm(int offset, EventHandler<Alarm> handler)
handler
- Event handler to be called on alarm.offset
- Offset into the future in milliseconds.IllegalStateException
- When the clock has been already closed.void close()
close
in interface AutoCloseable
void stop()
void stop(Throwable exception)
boolean isIdle()
boolean isClosed()
Copyright © 2017 The Apache Software Foundation. All rights reserved.