Interface EPEventServiceTimeControl

All Known Subinterfaces:
EPEventService, EPStageEventService

public interface EPEventServiceTimeControl
Service for advancing and controlling time.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    advanceTime(long time)
    Advance time by jumping to the given time in milliseconds (or nanoseconds if so configured).
    void
    advanceTimeSpan(long time)
    Advance time by continually-sliding to the given time in milliseconds (or nanoseconds if so configured) at the smallest resolution (non-hopping).
    void
    advanceTimeSpan(long time, long resolution)
    Advance time by continually-sliding to the given time in milliseconds (or nanoseconds if so configured) at the provided resolution (hopping).
    void
    Switches off the internal timer which tracks system time.
    void
    Switches on the internal timer which tracks system time.
    long
    Returns current engine time.
    Returns the time at which the next schedule execution is expected, returns null if no schedule execution is outstanding.
    boolean
    Returns true for external clocking, false for internal clocking.
  • Method Details

    • advanceTime

      void advanceTime(long time)
      Advance time by jumping to the given time in milliseconds (or nanoseconds if so configured).

      For externally controlling the time within a runtime.

      External clocking must be first be enabled by configuration ConfigurationRuntimeThreading.setInternalTimerEnabled(boolean) passing false or by calling clockExternal().

      Time should never move backwards (unless for testing purposes where previous results can be thrown away)

      Parameters:
      time - time
    • advanceTimeSpan

      void advanceTimeSpan(long time)
      Advance time by continually-sliding to the given time in milliseconds (or nanoseconds if so configured) at the smallest resolution (non-hopping).

      For externally controlling the time within a runtime.

      External clocking must be first be enabled by configuration ConfigurationRuntimeThreading.setInternalTimerEnabled(boolean) passing false or by calling clockExternal().

      Time should never move backwards (unless for testing purposes where previous results can be thrown away)

      Parameters:
      time - time
    • advanceTimeSpan

      void advanceTimeSpan(long time, long resolution)
      Advance time by continually-sliding to the given time in milliseconds (or nanoseconds if so configured) at the provided resolution (hopping).

      For externally controlling the time within a runtime.

      External clocking must be first be enabled by configuration ConfigurationRuntimeThreading.setInternalTimerEnabled(boolean) passing false or by calling clockExternal().

      Time should never move backwards (unless for testing purposes where previous results can be thrown away)

      Parameters:
      time - time
      resolution - the resolution to use
    • getCurrentTime

      long getCurrentTime()
      Returns current engine time.

      If time is provided externally via timer events, the function returns current time as externally provided.

      Returns:
      current engine time
    • getNextScheduledTime

      Long getNextScheduledTime()
      Returns the time at which the next schedule execution is expected, returns null if no schedule execution is outstanding.
      Returns:
      time of next schedule if any
    • clockInternal

      void clockInternal()
      Switches on the internal timer which tracks system time. There is no effect if the runtime is already on internal time.

      Your application may not want to use advanceTime(long), advanceTimeSpan(long) or advanceTimeSpan(long, long) after calling this method, since time advances according to JVM time.

    • clockExternal

      void clockExternal()
      Switches off the internal timer which tracks system time. There is no effect if the runtime is already on external internal time.

      Your application may want to use advanceTime(long), advanceTimeSpan(long) or advanceTimeSpan(long, long) after calling this method to set or advance time.

      Its generally preferable to turn off internal clocking (and thus turn on external clocking) by configuration ConfigurationRuntimeThreading.setInternalTimerEnabled(boolean) passing false.

    • isExternalClockingEnabled

      boolean isExternalClockingEnabled()
      Returns true for external clocking, false for internal clocking.
      Returns:
      clocking indicator