public interface SchedulingService extends TimeProvider
Modifier and Type | Method and Description |
---|---|
void |
add(long afterMSec,
ScheduleHandle handle,
long scheduleSlot)
Add a callback for after the given milliseconds from the current time.
|
void |
destroy()
Destroy the service.
|
void |
evaluate(Collection<ScheduleHandle> handles)
Evaluate the current time and add to the collection any handles scheduled for execution.
|
Long |
getFurthestTimeHandle()
Returns furthest in the future handle.
|
int |
getScheduleHandleCount()
Returns count of handles.
|
int |
getTimeHandleCount()
Returns time handle count.
|
boolean |
isScheduled(ScheduleHandle handle)
Returns true if the handle has been scheduled already.
|
void |
remove(ScheduleHandle handle,
long scheduleSlot)
Remove a handle.
|
void |
setTime(long timestamp)
Set the time based upon which the evaluation of events invokes callbacks.
|
getTime
void add(long afterMSec, ScheduleHandle handle, long scheduleSlot) throws ScheduleServiceException
afterMSec
- number of millisec to get a callbackhandle
- to addscheduleSlot
- allows ordering of concurrent callbacksScheduleServiceException
- thrown if the add operation did not completevoid remove(ScheduleHandle handle, long scheduleSlot) throws ScheduleServiceException
handle
- to removescheduleSlot
- for which the callback was addedScheduleServiceException
- thrown if the callback was not locatedvoid setTime(long timestamp)
timestamp
- to setvoid evaluate(Collection<ScheduleHandle> handles)
handles
- is a collection of handles populated by the service with any callbacks due
for the current timevoid destroy()
int getTimeHandleCount()
Long getFurthestTimeHandle()
int getScheduleHandleCount()
boolean isScheduled(ScheduleHandle handle)
handle
- to check