Interface Timer


  • 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.
    Author:
    Kai Kreuzer - Initial contribution
    • Method Detail

      • cancel

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

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

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

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

        boolean hasTerminated()
        Determines whether the scheduled execution has already terminated.
        Returns:
        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.
        Parameters:
        newTime - the new time to execute the code
        Returns:
        true, if the rescheduling was done successful