public class SupportSchedulingServiceImpl extends Object implements SchedulingService
Constructor and Description |
---|
SupportSchedulingServiceImpl() |
Modifier and Type | Method and Description |
---|---|
void |
add(long afterTime,
ScheduleHandle callback,
long scheduleSlot)
Add a callback for after the given milliseconds from the current time.
|
ScheduleBucket |
allocateBucket() |
void |
destroy()
Destroy the service.
|
void |
evaluate(Collection<ScheduleHandle> handles)
Evaluate the current time and add to the collection any handles scheduled for execution.
|
void |
evaluateLock() |
static void |
evaluateSchedule(SchedulingService service) |
void |
evaluateUnLock() |
Map<Long,ScheduleHandle> |
getAdded() |
Long |
getFurthestTimeHandle()
Returns furthest in the future handle.
|
int |
getScheduleHandleCount()
Returns count of handles.
|
long |
getTime()
Returns the current engine time.
|
int |
getTimeHandleCount()
Returns time handle count.
|
boolean |
isScheduled(ScheduleHandle scheduleHandle)
Returns true if the handle has been scheduled already.
|
void |
remove(ScheduleHandle callback,
long scheduleSlot)
Remove a handle.
|
void |
setTime(long currentTime)
Set the time based upon which the evaluation of events invokes callbacks.
|
public Map<Long,ScheduleHandle> getAdded()
public void evaluateLock()
public void evaluateUnLock()
public void add(long afterTime, ScheduleHandle callback, long scheduleSlot)
SchedulingService
add
in interface SchedulingService
afterTime
- number of millisec to get a callbackcallback
- to addscheduleSlot
- allows ordering of concurrent callbackspublic void remove(ScheduleHandle callback, long scheduleSlot)
SchedulingService
remove
in interface SchedulingService
callback
- to removescheduleSlot
- for which the callback was addedpublic long getTime()
TimeProvider
getTime
in interface TimeProvider
public void setTime(long currentTime)
SchedulingService
setTime
in interface SchedulingService
currentTime
- to setpublic void evaluate(Collection<ScheduleHandle> handles)
SchedulingService
evaluate
in interface SchedulingService
handles
- is a collection of handles populated by the service with any callbacks due
for the current timepublic ScheduleBucket allocateBucket()
public static void evaluateSchedule(SchedulingService service)
public void destroy()
SchedulingService
destroy
in interface SchedulingService
public int getTimeHandleCount()
SchedulingService
getTimeHandleCount
in interface SchedulingService
public Long getFurthestTimeHandle()
SchedulingService
getFurthestTimeHandle
in interface SchedulingService
public int getScheduleHandleCount()
SchedulingService
getScheduleHandleCount
in interface SchedulingService
public boolean isScheduled(ScheduleHandle scheduleHandle)
SchedulingService
isScheduled
in interface SchedulingService
scheduleHandle
- to check