Class SchedulingServiceImpl

java.lang.Object
com.espertech.esper.runtime.internal.schedulesvcimpl.SchedulingServiceImpl
All Implemented Interfaces:
com.espertech.esper.common.internal.schedule.SchedulingService, com.espertech.esper.common.internal.schedule.TimeProvider, SchedulingServiceSPI

public final class SchedulingServiceImpl extends Object implements SchedulingServiceSPI
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 Details

    • SchedulingServiceImpl

      public SchedulingServiceImpl(int stageId, com.espertech.esper.common.internal.schedule.TimeSourceService timeSourceService, ZoneId defaultFormatterTimeZone)
      Constructor.
      Parameters:
      timeSourceService - time source provider
      stageId - stage id or -1 when not applicable
      defaultFormatterTimeZone - time zone for audit formatter
  • Method Details

    • destroy

      public void destroy()
      Specified by:
      destroy in interface com.espertech.esper.common.internal.schedule.SchedulingService
    • getTime

      public long getTime()
      Specified by:
      getTime in interface com.espertech.esper.common.internal.schedule.TimeProvider
    • setTime

      public final void setTime(long currentTime)
      Specified by:
      setTime in interface com.espertech.esper.common.internal.schedule.SchedulingService
    • add

      public final void add(long afterTime, com.espertech.esper.common.internal.schedule.ScheduleHandle handle, long slot) throws com.espertech.esper.common.internal.schedule.ScheduleServiceException
      Specified by:
      add in interface com.espertech.esper.common.internal.schedule.SchedulingService
      Throws:
      com.espertech.esper.common.internal.schedule.ScheduleServiceException
    • remove

      public final void remove(com.espertech.esper.common.internal.schedule.ScheduleHandle handle, long slot)
      Specified by:
      remove in interface com.espertech.esper.common.internal.schedule.SchedulingService
    • evaluate

      public final void evaluate(Collection<com.espertech.esper.common.internal.schedule.ScheduleHandle> handles)
      Specified by:
      evaluate in interface com.espertech.esper.common.internal.schedule.SchedulingService
    • transfer

      public void transfer(Set<Integer> statementIds, SchedulingServiceSPI schedulingService)
      Specified by:
      transfer in interface SchedulingServiceSPI
    • init

      public void init()
      Description copied from interface: SchedulingServiceSPI
      Initialization is optional and provides a chance to preload things after statements are available.
      Specified by:
      init in interface SchedulingServiceSPI
    • getTimeHandleCount

      public int getTimeHandleCount()
      Specified by:
      getTimeHandleCount in interface com.espertech.esper.common.internal.schedule.SchedulingService
    • getFurthestTimeHandleDate

      public String getFurthestTimeHandleDate()
    • getNearestTimeHandleDate

      public String getNearestTimeHandleDate()
    • getFurthestTimeHandle

      public Long getFurthestTimeHandle()
      Specified by:
      getFurthestTimeHandle in interface com.espertech.esper.common.internal.schedule.SchedulingService
    • getScheduleHandleCount

      public int getScheduleHandleCount()
      Specified by:
      getScheduleHandleCount in interface com.espertech.esper.common.internal.schedule.SchedulingService
    • isScheduled

      public boolean isScheduled(com.espertech.esper.common.internal.schedule.ScheduleHandle handle)
      Specified by:
      isScheduled in interface com.espertech.esper.common.internal.schedule.SchedulingService
    • getNearestTimeHandle

      public Long getNearestTimeHandle()
      Specified by:
      getNearestTimeHandle in interface SchedulingServiceSPI
    • visitSchedules

      public void visitSchedules(ScheduleVisitor visitor)
      Specified by:
      visitSchedules in interface SchedulingServiceSPI
    • getDefaultFormatter

      public DateTimeFormatter getDefaultFormatter()
      Specified by:
      getDefaultFormatter in interface com.espertech.esper.common.internal.schedule.TimeProvider