Interface TimerService
-
- All Superinterfaces:
ProcessingTimeService
,ProcessingTimeService
- All Known Implementing Classes:
NeverFireProcessingTimeService
,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:
- In the initial state, it accepts timer registrations and triggers when the time is reached.
- After calling
ProcessingTimeService.quiesce()
, further calls toProcessingTimeService.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. - After a call to
shutdownService()
, all calls toProcessingTimeService.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
ProcessingTimeService.ProcessingTimeCallback
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
isTerminated()
Returns true if the service has been shut down, false otherwise.void
shutdownService()
Shuts down and clean up the timer service provider hard and immediately.boolean
shutdownServiceUninterruptible(long timeoutMs)
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 Detail
-
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 toProcessingTimeService.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 toProcessingTimeService.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.
-
-