Class BatchExecutionInternalTimeServiceManager<K>
java.lang.Object
org.apache.flink.streaming.api.operators.sorted.state.BatchExecutionInternalTimeServiceManager<K>
- All Implemented Interfaces:
KeyedStateBackend.KeySelectionListener<K>,InternalTimeServiceManager<K>
public class BatchExecutionInternalTimeServiceManager<K>
extends Object
implements InternalTimeServiceManager<K>, KeyedStateBackend.KeySelectionListener<K>
An implementation of a
InternalTimeServiceManager that manages timers with a single
active key at a time. Can be used in a BATCH execution mode.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.flink.streaming.api.operators.InternalTimeServiceManager
InternalTimeServiceManager.Provider, InternalTimeServiceManager.ShouldStopAdvancingFn -
Constructor Summary
ConstructorsConstructorDescriptionBatchExecutionInternalTimeServiceManager(ProcessingTimeService processingTimeService, boolean asyncStateProcessingMode) -
Method Summary
Modifier and TypeMethodDescriptionvoidadvanceWatermark(Watermark watermark) Advances the Watermark of all managedtimer services, potentially firing event time timers.static <K> InternalTimeServiceManager<K>create(TaskIOMetricGroup taskIOMetricGroup, PriorityQueueSetFactory factory, KeyGroupRange keyGroupRange, ClassLoader userClassloader, KeyContext keyContext, ProcessingTimeService processingTimeService, Iterable<KeyGroupStatePartitionStreamProvider> rawKeyedStates, StreamTaskCancellationContext cancellationContext) <N> InternalTimerService<N>getInternalTimerService(String name, org.apache.flink.api.common.typeutils.TypeSerializer<K> keySerializer, org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer, Triggerable<K, N> triggerable) Creates anInternalTimerServicefor handling a group of timers identified by the givenname.voidkeySelected(K newKey) Callback when key context is switched.voidsnapshotToRawKeyedState(KeyedStateCheckpointOutputStream context, String operatorName) Snapshots the timers to raw keyed state.booleantryAdvanceWatermark(Watermark watermark, InternalTimeServiceManager.ShouldStopAdvancingFn shouldStopAdvancingFn) Try toInternalTimeServiceManager.advanceWatermark(Watermark), but ifInternalTimeServiceManager.ShouldStopAdvancingFnreturnstrue, stop the advancement and return as soon as possible.
-
Constructor Details
-
BatchExecutionInternalTimeServiceManager
public BatchExecutionInternalTimeServiceManager(ProcessingTimeService processingTimeService, boolean asyncStateProcessingMode)
-
-
Method Details
-
getInternalTimerService
public <N> InternalTimerService<N> getInternalTimerService(String name, org.apache.flink.api.common.typeutils.TypeSerializer<K> keySerializer, org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer, Triggerable<K, N> triggerable) Description copied from interface:InternalTimeServiceManagerCreates anInternalTimerServicefor handling a group of timers identified by the givenname. The timers are scoped to a key and namespace.When a timer fires the given
Triggerablewill be invoked.- Specified by:
getInternalTimerServicein interfaceInternalTimeServiceManager<K>
-
advanceWatermark
Description copied from interface:InternalTimeServiceManagerAdvances the Watermark of all managedtimer services, potentially firing event time timers.- Specified by:
advanceWatermarkin interfaceInternalTimeServiceManager<K>
-
tryAdvanceWatermark
public boolean tryAdvanceWatermark(Watermark watermark, InternalTimeServiceManager.ShouldStopAdvancingFn shouldStopAdvancingFn) Description copied from interface:InternalTimeServiceManagerTry toInternalTimeServiceManager.advanceWatermark(Watermark), but ifInternalTimeServiceManager.ShouldStopAdvancingFnreturnstrue, stop the advancement and return as soon as possible.- Specified by:
tryAdvanceWatermarkin interfaceInternalTimeServiceManager<K>- Returns:
- true if
Watermarkhas been fully processed, false otherwise.
-
snapshotToRawKeyedState
public void snapshotToRawKeyedState(KeyedStateCheckpointOutputStream context, String operatorName) throws Exception Description copied from interface:InternalTimeServiceManagerSnapshots the timers to raw keyed state.TODO: This can be removed once heap-based timers are integrated with RocksDB incremental snapshots.
- Specified by:
snapshotToRawKeyedStatein interfaceInternalTimeServiceManager<K>- Throws:
Exception
-
create
public static <K> InternalTimeServiceManager<K> create(TaskIOMetricGroup taskIOMetricGroup, PriorityQueueSetFactory factory, KeyGroupRange keyGroupRange, ClassLoader userClassloader, KeyContext keyContext, ProcessingTimeService processingTimeService, Iterable<KeyGroupStatePartitionStreamProvider> rawKeyedStates, StreamTaskCancellationContext cancellationContext) -
keySelected
Description copied from interface:KeyedStateBackend.KeySelectionListenerCallback when key context is switched.- Specified by:
keySelectedin interfaceKeyedStateBackend.KeySelectionListener<K>
-