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 aInternalTimeServiceManagerthat 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
Constructors Constructor Description BatchExecutionInternalTimeServiceManager(ProcessingTimeService processingTimeService)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadvanceWatermark(Watermark watermark)Advances the Watermark of all managedtimer services, potentially firing event time timers.static <K> InternalTimeServiceManager<K>create(TaskIOMetricGroup taskIOMetricGroup, CheckpointableKeyedStateBackend<K> keyedStatedBackend, ClassLoader userClassloader, KeyContext keyContext, ProcessingTimeService processingTimeService, Iterable<KeyGroupStatePartitionStreamProvider> rawKeyedStates, StreamTaskCancellationContext cancellationContext)<N> InternalTimerService<N>getAsyncInternalTimerService(String name, org.apache.flink.api.common.typeutils.TypeSerializer<K> keySerializer, org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer, Triggerable<K,N> triggerable, AsyncExecutionController<K> asyncExecutionController)Creates anInternalTimerServiceAsyncImplfor handling a group of timers identified by the givenname.<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 Detail
-
BatchExecutionInternalTimeServiceManager
public BatchExecutionInternalTimeServiceManager(ProcessingTimeService processingTimeService)
-
-
Method Detail
-
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>
-
getAsyncInternalTimerService
public <N> InternalTimerService<N> getAsyncInternalTimerService(String name, org.apache.flink.api.common.typeutils.TypeSerializer<K> keySerializer, org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer, Triggerable<K,N> triggerable, AsyncExecutionController<K> asyncExecutionController)
Description copied from interface:InternalTimeServiceManagerCreates anInternalTimerServiceAsyncImplfor handling a group of timers identified by the givenname. The timers are scoped to a key and namespace. Mainly used by async operators.Some essential order preservation will be added when the given
Triggerableis invoked.- Specified by:
getAsyncInternalTimerServicein interfaceInternalTimeServiceManager<K>
-
advanceWatermark
public void advanceWatermark(Watermark watermark)
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, CheckpointableKeyedStateBackend<K> keyedStatedBackend, ClassLoader userClassloader, KeyContext keyContext, ProcessingTimeService processingTimeService, Iterable<KeyGroupStatePartitionStreamProvider> rawKeyedStates, StreamTaskCancellationContext cancellationContext)
-
keySelected
public void keySelected(K newKey)
Description copied from interface:KeyedStateBackend.KeySelectionListenerCallback when key context is switched.- Specified by:
keySelectedin interfaceKeyedStateBackend.KeySelectionListener<K>
-
-