com.espertech.esper.core.support
Class SupportSchedulingServiceImpl

java.lang.Object
  extended by com.espertech.esper.core.support.SupportSchedulingServiceImpl
All Implemented Interfaces:
SchedulingService, TimeProvider

public class SupportSchedulingServiceImpl
extends java.lang.Object
implements SchedulingService


Constructor Summary
SupportSchedulingServiceImpl()
           
 
Method Summary
 void add(long afterMSec, ScheduleHandle callback, ScheduleSlot slot)
          Add a callback for after the given milliseconds from the current time.
 ScheduleBucket allocateBucket()
           
 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.
 void evaluateLock()
           
static void evaluateSchedule(SchedulingService service)
           
 void evaluateUnLock()
           
 java.util.Map<java.lang.Long,ScheduleHandle> getAdded()
           
 java.lang.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.
 boolean isScheduled(ScheduleHandle scheduleHandle)
          Returns true if the handle has been scheduled already.
 void remove(ScheduleHandle callback, 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

SupportSchedulingServiceImpl

public SupportSchedulingServiceImpl()
Method Detail

getAdded

public java.util.Map<java.lang.Long,ScheduleHandle> getAdded()

evaluateLock

public void evaluateLock()

evaluateUnLock

public void evaluateUnLock()

add

public void add(long afterMSec,
                ScheduleHandle callback,
                ScheduleSlot slot)
Description copied from interface: SchedulingService
Add a callback for after the given milliseconds from the current time. If the same callback (equals) was already added before, the method will not add a new callback or change the existing callback to a new time, but throw an exception.

Specified by:
add in interface SchedulingService
Parameters:
afterMSec - number of millisec to get a callback
callback - to add
slot - allows ordering of concurrent callbacks

remove

public void remove(ScheduleHandle callback,
                   ScheduleSlot slot)
Description copied from interface: SchedulingService
Remove a handle. If the handle to be removed was not found an exception is thrown.

Specified by:
remove in interface SchedulingService
Parameters:
callback - to remove
slot - for which the callback was added

getTime

public long getTime()
Description copied from interface: TimeProvider
Returns the current engine time.

Specified by:
getTime in interface TimeProvider
Returns:
time that has last been set

setTime

public void setTime(long currentTime)
Description copied from interface: SchedulingService
Set the time based upon which the evaluation of events invokes callbacks.

Specified by:
setTime in interface SchedulingService
Parameters:
currentTime - to set

evaluate

public void evaluate(java.util.Collection<ScheduleHandle> handles)
Description copied from interface: SchedulingService
Evaluate the current time and add to the collection any handles scheduled for execution.

Specified by:
evaluate in interface SchedulingService
Parameters:
handles - is a collection of handles populated by the service with any callbacks due for the current time

allocateBucket

public ScheduleBucket allocateBucket()

evaluateSchedule

public static void evaluateSchedule(SchedulingService service)

destroy

public void destroy()
Description copied from interface: SchedulingService
Destroy the service.

Specified by:
destroy in interface SchedulingService

getTimeHandleCount

public int getTimeHandleCount()
Description copied from interface: SchedulingService
Returns time handle count.

Specified by:
getTimeHandleCount in interface SchedulingService
Returns:
count

getFurthestTimeHandle

public java.lang.Long getFurthestTimeHandle()
Description copied from interface: SchedulingService
Returns furthest in the future handle.

Specified by:
getFurthestTimeHandle in interface SchedulingService
Returns:
future handle

getScheduleHandleCount

public int getScheduleHandleCount()
Description copied from interface: SchedulingService
Returns count of handles.

Specified by:
getScheduleHandleCount in interface SchedulingService
Returns:
count

isScheduled

public boolean isScheduled(ScheduleHandle scheduleHandle)
Description copied from interface: SchedulingService
Returns true if the handle has been scheduled already.

Specified by:
isScheduled in interface SchedulingService
Parameters:
scheduleHandle - to check
Returns:
indicator whether the handle is in use

© 2006-2016 EsperTech Inc.
All rights reserved.
Visit us at espertech.com