Interface Timer

  • @NonNullByDefault
    public interface Timer
    A timer is a handle for a block of code that is scheduled for future execution. A timer can be canceled or rescheduled. The script action "createTimer" returns a Timer instance.
    Kai Kreuzer - Initial contribution
    • Method Detail

      • cancel

        boolean cancel()
        Cancels the timer
        true, if cancellation was successful
      • getExecutionTime

        @Nullable ZonedDateTime getExecutionTime()
        Gets the scheduled exection time
        the scheduled execution time, or null if the timer was cancelled
      • isActive

        boolean isActive()
        Determines whether the scheduled execution is yet to happen.
        true, if the code is still scheduled to execute, false otherwise
      • isCancelled

        boolean isCancelled()
        Determines whether the timer has been cancelled
        true, if the timer has been cancelled, false otherwise
      • isRunning

        boolean isRunning()
        Determines whether the scheduled code is currently executed.
        true, if the code is being executed, false otherwise
      • hasTerminated

        boolean hasTerminated()
        Determines whether the scheduled execution has already terminated.
        true, if the scheduled execution has already terminated, false otherwise
      • reschedule

        boolean reschedule​(ZonedDateTime newTime)
        Reschedules a timer to a new starting time. This can also be called after a timer has terminated, which will result in another execution of the same code.
        newTime - the new time to execute the code
        true, if the rescheduling was done successful