Interface TimerService

All Superinterfaces:
org.apache.flink.api.common.operators.ProcessingTimeService, ProcessingTimeService
All Known Implementing Classes:
SystemProcessingTimeService

@Internal public interface TimerService extends ProcessingTimeService
A common timer service interface with life cycle methods.

The registration of timers follows a life cycle of three phases:

  1. In the initial state, it accepts timer registrations and triggers when the time is reached.
  2. After calling ProcessingTimeService.quiesce(), further calls to ProcessingTimeService.registerTimer(long, ProcessingTimeCallback) will not register any further timers, and will return a "dummy" future as a result. This is used for clean shutdown, where currently firing timers are waited for and no future timers can be scheduled, without causing hard exceptions.
  3. After a call to shutdownService(), all calls to ProcessingTimeService.registerTimer(long, ProcessingTimeCallback) will result in a hard exception.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.apache.flink.api.common.operators.ProcessingTimeService

    org.apache.flink.api.common.operators.ProcessingTimeService.ProcessingTimeCallback
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns true if the service has been shut down, false otherwise.
    void
    Shuts down and clean up the timer service provider hard and immediately.
    boolean
    Shuts down and clean up the timer service provider hard and immediately.

    Methods inherited from interface org.apache.flink.api.common.operators.ProcessingTimeService

    registerTimer

    Methods inherited from interface org.apache.flink.streaming.runtime.tasks.ProcessingTimeService

    getClock, getCurrentProcessingTime, quiesce, scheduleAtFixedRate, scheduleWithFixedDelay
  • Method Details

    • isTerminated

      boolean isTerminated()
      Returns true if the service has been shut down, false otherwise.
    • shutdownService

      void shutdownService()
      Shuts down and clean up the timer service provider hard and immediately. This does not wait for any timer to complete. Any further call to ProcessingTimeService.registerTimer(long, ProcessingTimeCallback) will result in a hard exception.
    • shutdownServiceUninterruptible

      boolean shutdownServiceUninterruptible(long timeoutMs)
      Shuts down and clean up the timer service provider hard and immediately. This does not wait for any timer to complete. Any further call to ProcessingTimeService.registerTimer(long, ProcessingTimeCallback) will result in a hard exception. This call cannot be interrupted and will block until the shutdown is completed or the timeout is exceeded.
      Parameters:
      timeoutMs - timeout for blocking on the service shutdown in milliseconds.
      Returns:
      returns true iff the shutdown was completed.