|
||||||||||
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(TimeSourceService timeSourceService)
Constructor. |
Method Summary | |
---|---|
void |
add(long afterMSec,
ScheduleHandle handle,
ScheduleSlot slot)
Add a callback for after the given milliseconds from the current time. |
void |
apply(ScheduleSet scheduleSet)
Apply the set of schedules. |
void |
destroy()
Destroy the service. |
void |
evaluate(java.util.Collection<ScheduleHandle> handles)
Evaluate the current time and add to the collection any handles scheduled for execution. |
java.lang.Long |
getFurthestTimeHandle()
Returns furthest in the future handle. |
java.lang.String |
getFurthestTimeHandleDate()
|
java.lang.Long |
getNearestTimeHandle()
|
java.lang.String |
getNearestTimeHandleDate()
|
int |
getScheduleHandleCount()
Returns count of handles. |
long |
getTime()
Returns the current engine time. |
int |
getTimeHandleCount()
Returns time handle count. |
boolean |
isScheduled(ScheduleHandle handle)
Returns true if the handle has been scheduled already. |
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. |
ScheduleSet |
take(java.util.Set<java.lang.String> statementIds)
Take a statement's schedules out of the currently active set of schedules. |
void |
visitSchedules(ScheduleVisitor visitor)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SchedulingServiceImpl(TimeSourceService timeSourceService)
timeSourceService
- time source providerMethod Detail |
---|
public void destroy()
SchedulingService
destroy
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 completepublic final void remove(ScheduleHandle handle, ScheduleSlot slot)
SchedulingService
remove
in interface SchedulingService
handle
- to removeslot
- for which the callback was addedpublic final void evaluate(java.util.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 ScheduleSet take(java.util.Set<java.lang.String> statementIds)
SchedulingServiceSPI
take
in interface SchedulingServiceSPI
statementIds
- statements to take out
public void apply(ScheduleSet scheduleSet)
SchedulingServiceSPI
apply
in interface SchedulingServiceSPI
scheduleSet
- to applypublic int getTimeHandleCount()
SchedulingService
getTimeHandleCount
in interface SchedulingService
public java.lang.String getFurthestTimeHandleDate()
public java.lang.String getNearestTimeHandleDate()
public java.lang.Long getFurthestTimeHandle()
SchedulingService
getFurthestTimeHandle
in interface SchedulingService
public int getScheduleHandleCount()
SchedulingService
getScheduleHandleCount
in interface SchedulingService
public boolean isScheduled(ScheduleHandle handle)
SchedulingService
isScheduled
in interface SchedulingService
handle
- to check
public java.lang.Long getNearestTimeHandle()
getNearestTimeHandle
in interface SchedulingServiceSPI
public void visitSchedules(ScheduleVisitor visitor)
visitSchedules
in interface SchedulingServiceSPI
|
© 2006-2015 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 |