Interface TimerService
- All Superinterfaces:
org.apache.flink.api.common.operators.ProcessingTimeService,ProcessingTimeService
- All Known Implementing Classes:
SystemProcessingTimeService
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
org.apache.flink.api.common.operators.ProcessingTimeService.ProcessingTimeCallback -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns true if the service has been shut down, false otherwise.voidShuts down and clean up the timer service provider hard and immediately.booleanshutdownServiceUninterruptible(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
registerTimerMethods 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 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.
-