public class SchedulingServiceAudit extends Object implements SchedulingServiceSPI
Constructor and Description |
---|
SchedulingServiceAudit(String engineUri,
String statementName,
SchedulingServiceSPI spi) |
Modifier and Type | Method and Description |
---|---|
void |
add(long afterMSec,
ScheduleHandle handle,
long 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(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.
|
Long |
getNearestTimeHandle() |
int |
getScheduleHandleCount()
Returns count of handles.
|
long |
getTime()
Returns the current engine time.
|
int |
getTimeHandleCount()
Returns time handle count.
|
void |
init()
Initialization is optional and provides a chance to preload things after statements are available.
|
boolean |
isScheduled(ScheduleHandle handle)
Returns true if the handle has been scheduled already.
|
void |
remove(ScheduleHandle handle,
long slot)
Remove a handle.
|
void |
setTime(long timestamp)
Set the time based upon which the evaluation of events invokes callbacks.
|
ScheduleSet |
take(Set<Integer> statementId)
Take a statement's schedules out of the currently active set of schedules.
|
void |
visitSchedules(ScheduleVisitor visitor) |
public SchedulingServiceAudit(String engineUri, String statementName, SchedulingServiceSPI spi)
public boolean isScheduled(ScheduleHandle handle)
SchedulingService
isScheduled
in interface SchedulingService
handle
- to checkpublic ScheduleSet take(Set<Integer> statementId)
SchedulingServiceSPI
take
in interface SchedulingServiceSPI
statementId
- statements to take outpublic void apply(ScheduleSet scheduleSet)
SchedulingServiceSPI
apply
in interface SchedulingServiceSPI
scheduleSet
- to applypublic Long getNearestTimeHandle()
getNearestTimeHandle
in interface SchedulingServiceSPI
public void visitSchedules(ScheduleVisitor visitor)
visitSchedules
in interface SchedulingServiceSPI
public void add(long afterMSec, ScheduleHandle handle, long slot) throws ScheduleServiceException
SchedulingService
add
in interface SchedulingService
afterMSec
- number of millisec to get a callbackhandle
- to addslot
- allows ordering of concurrent callbacksScheduleServiceException
- thrown if the add operation did not completepublic void remove(ScheduleHandle handle, long slot) throws ScheduleServiceException
SchedulingService
remove
in interface SchedulingService
handle
- to removeslot
- for which the callback was addedScheduleServiceException
- thrown if the callback was not locatedpublic void setTime(long timestamp)
SchedulingService
setTime
in interface SchedulingService
timestamp
- 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 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 long getTime()
TimeProvider
getTime
in interface TimeProvider
public void init()
SchedulingServiceSPI
init
in interface SchedulingServiceSPI