|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface SchedulingService
Interface for a service that allows to add and remove handles (typically storing callbacks) for a certain time which are returned when the evaluate method is invoked and the current time is on or after the handle's registered time. It is the expectation that the setTime method is called with same or ascending values for each subsequent call. Handles with are triggered are automatically removed by implementations.
Method Summary | |
---|---|
void |
add(long afterMSec,
ScheduleHandle handle,
ScheduleSlot slot)
Add a callback for after the given milliseconds from the current time. |
void |
add(ScheduleSpec scheduleSpec,
ScheduleHandle handle,
ScheduleSlot slot)
Add a callback for a time specified by the schedule specification passed in based on the current time. |
ScheduleBucket |
allocateBucket()
Returns a bucket from which slots can be allocated for ordering concurrent callbacks. |
void |
evaluate(Collection<ScheduleHandle> handles)
Evaluate the current time and add to the collection any handles scheduled for execution. |
void |
evaluateLock()
Scheduling service evaluation lock to synchronize evaluation with engine locks. |
void |
evaluateUnLock()
Scheduling service evaluation unlock to synchronize evaluation with engine locks. |
long |
getTime()
Gets the last time known to the scheduling service. |
void |
remove(ScheduleHandle handle,
ScheduleSlot slot)
Remove a handle. |
void |
setTime(long timestamp)
Set the time based upon which the evaluation of events invokes callbacks. |
Method Detail |
---|
void add(long afterMSec, ScheduleHandle handle, ScheduleSlot slot) throws ScheduleServiceException
afterMSec
- number of millisec to get a callbackhandle
- to addslot
- allows ordering of concurrent callbacks
ScheduleServiceException
- thrown if the add operation did not complete
ScheduleHandleExistsException
- to indicate the handle already existedvoid add(ScheduleSpec scheduleSpec, ScheduleHandle handle, ScheduleSlot slot) throws ScheduleServiceException
scheduleSpec
- holds the crontab-like information defining the next occurancehandle
- to addslot
- allows ordering of concurrent callbacks
ScheduleServiceException
- thrown if the add operation did not completevoid remove(ScheduleHandle handle, ScheduleSlot slot) throws ScheduleServiceException
handle
- to removeslot
- for which the callback was added
ScheduleServiceException
- thrown if the callback was not locatedlong getTime()
void setTime(long timestamp)
timestamp
- to setvoid evaluateLock()
void evaluateUnLock()
void evaluate(Collection<ScheduleHandle> handles)
handles
- is a collection of handles populated by the service with any callbacks due
for the current timeScheduleBucket allocateBucket()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |