|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.espertech.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 |
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. |
long |
getTime()
Returns the current engine time. |
int |
getTimeHandleCount()
Returns time handle count. |
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 void destroy()
SchedulingService
destroy
in interface SchedulingService
public ScheduleBucket allocateBucket()
SchedulingService
allocateBucket
in interface SchedulingService
public long getTime()
TimeProvider
getTime
in interface TimeProvider
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 timepublic int getTimeHandleCount()
SchedulingService
getTimeHandleCount
in interface SchedulingService
public long getFurthestTimeHandle()
SchedulingService
getFurthestTimeHandle
in interface SchedulingService
public int getScheduleHandleCount()
SchedulingService
getScheduleHandleCount
in interface SchedulingService
|
© 2007 EsperTech Inc. All rights reserved. Visit us at espertech.com |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |