Class NeverFireProcessingTimeService
- java.lang.Object
-
- org.apache.flink.state.api.runtime.NeverFireProcessingTimeService
-
- All Implemented Interfaces:
ProcessingTimeService
,ProcessingTimeService
,TimerService
@Internal public final class NeverFireProcessingTimeService extends Object implements TimerService
A processing time service whose timers never fire so all timers are included in savepoints.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.flink.api.common.operators.ProcessingTimeService
ProcessingTimeService.ProcessingTimeCallback
-
-
Constructor Summary
Constructors Constructor Description NeverFireProcessingTimeService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Clock
getClock()
ReturnsClock
associated with this timer service.boolean
isTerminated()
Returns true if the service has been shut down, false otherwise.CompletableFuture<Void>
quiesce()
This method puts the service into a state where it does not register new timers, but returns for each call toProcessingTimeService.registerTimer(long, org.apache.flink.api.common.operators.ProcessingTimeService.ProcessingTimeCallback)
orProcessingTimeService.scheduleAtFixedRate(org.apache.flink.api.common.operators.ProcessingTimeService.ProcessingTimeCallback, long, long)
a "mock" future and the "mock" future will be never completed.ScheduledFuture<?>
registerTimer(long timestamp, ProcessingTimeService.ProcessingTimeCallback target)
Registers a task to be executed when (processing) time istimestamp
.ScheduledFuture<?>
scheduleAtFixedRate(ProcessingTimeService.ProcessingTimeCallback callback, long initialDelay, long period)
Registers a task to be executed repeatedly at a fixed rate.ScheduledFuture<?>
scheduleWithFixedDelay(ProcessingTimeService.ProcessingTimeCallback callback, long initialDelay, long period)
Registers a task to be executed repeatedly with a fixed delay.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 class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.flink.streaming.runtime.tasks.ProcessingTimeService
getCurrentProcessingTime
-
-
-
-
Method Detail
-
getClock
public Clock getClock()
Description copied from interface:ProcessingTimeService
ReturnsClock
associated with this timer service.- Specified by:
getClock
in interfaceProcessingTimeService
-
registerTimer
public ScheduledFuture<?> registerTimer(long timestamp, ProcessingTimeService.ProcessingTimeCallback target)
Description copied from interface:ProcessingTimeService
Registers a task to be executed when (processing) time istimestamp
.- Specified by:
registerTimer
in interfaceProcessingTimeService
- Parameters:
timestamp
- Time when the task is to be executed (in processing time)target
- The task to be executed- Returns:
- The future that represents the scheduled task. This always returns some future, even if the timer was shut down
-
scheduleAtFixedRate
public ScheduledFuture<?> scheduleAtFixedRate(ProcessingTimeService.ProcessingTimeCallback callback, long initialDelay, long period)
Description copied from interface:ProcessingTimeService
Registers a task to be executed repeatedly at a fixed rate.This call behaves similar to
ScheduledExecutor.scheduleAtFixedRate(Runnable, long, long, TimeUnit)
.- Specified by:
scheduleAtFixedRate
in interfaceProcessingTimeService
- Parameters:
callback
- to be executed after the initial delay and then after each periodinitialDelay
- initial delay to start executing callbackperiod
- after the initial delay after which the callback is executed- Returns:
- Scheduled future representing the task to be executed repeatedly
-
scheduleWithFixedDelay
public ScheduledFuture<?> scheduleWithFixedDelay(ProcessingTimeService.ProcessingTimeCallback callback, long initialDelay, long period)
Description copied from interface:ProcessingTimeService
Registers a task to be executed repeatedly with a fixed delay.This call behaves similar to
ScheduledExecutor.scheduleWithFixedDelay(Runnable, long, long, TimeUnit)
.- Specified by:
scheduleWithFixedDelay
in interfaceProcessingTimeService
- Parameters:
callback
- to be executed after the initial delay and then after each periodinitialDelay
- initial delay to start executing callbackperiod
- after the initial delay after which the callback is executed- Returns:
- Scheduled future representing the task to be executed repeatedly
-
isTerminated
public boolean isTerminated()
Description copied from interface:TimerService
Returns true if the service has been shut down, false otherwise.- Specified by:
isTerminated
in interfaceTimerService
-
quiesce
public CompletableFuture<Void> quiesce()
Description copied from interface:ProcessingTimeService
This method puts the service into a state where it does not register new timers, but returns for each call toProcessingTimeService.registerTimer(long, org.apache.flink.api.common.operators.ProcessingTimeService.ProcessingTimeCallback)
orProcessingTimeService.scheduleAtFixedRate(org.apache.flink.api.common.operators.ProcessingTimeService.ProcessingTimeCallback, long, long)
a "mock" future and the "mock" future will be never completed. Furthermore, the timers registered before are prevented from firing, but the timers in running are allowed to finish.If no timer is running, the quiesce-completed future is immediately completed and returned. Otherwise, the future returned will be completed when all running timers have finished.
- Specified by:
quiesce
in interfaceProcessingTimeService
-
shutdownService
public void shutdownService()
Description copied from interface:TimerService
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.- Specified by:
shutdownService
in interfaceTimerService
-
shutdownServiceUninterruptible
public boolean shutdownServiceUninterruptible(long timeoutMs)
Description copied from interface:TimerService
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.- Specified by:
shutdownServiceUninterruptible
in interfaceTimerService
- Parameters:
timeoutMs
- timeout for blocking on the service shutdown in milliseconds.- Returns:
- returns true iff the shutdown was completed.
-
-