|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.esper.schedule.SchedulingServiceImpl
public final class SchedulingServiceImpl
Implements the schedule service by simply keeping a sorted set of long millisecond values and a set of handles for each.
Synchronized since statement creation and event evaluation by multiple (event send) threads can lead to callbacks added/removed asynchronously.
Constructor Summary | |
---|---|
SchedulingServiceImpl()
Constructor. |
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 spec,
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. |
long |
getTime()
Gets the last time known to the scheduling service. |
void |
remove(ScheduleHandle handle,
ScheduleSlot slot)
Remove a handle. |
void |
setTime(long currentTime)
Set the time based upon which the evaluation of events invokes callbacks. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SchedulingServiceImpl()
Method Detail |
---|
public ScheduleBucket allocateBucket()
SchedulingService
allocateBucket
in interface SchedulingService
public long getTime()
SchedulingService
getTime
in interface SchedulingService
public final void setTime(long currentTime)
SchedulingService
setTime
in interface SchedulingService
currentTime
- to setpublic final void add(long afterMSec, ScheduleHandle handle, ScheduleSlot slot) throws ScheduleServiceException
SchedulingService
add
in interface SchedulingService
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 existedpublic final void add(ScheduleSpec spec, ScheduleHandle handle, ScheduleSlot slot)
SchedulingService
add
in interface SchedulingService
spec
- holds the crontab-like information defining the next occurancehandle
- to addslot
- allows ordering of concurrent callbackspublic final void remove(ScheduleHandle handle, ScheduleSlot slot)
SchedulingService
remove
in interface SchedulingService
handle
- to removeslot
- for which the callback was addedpublic final 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 time
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |