public class BatchExecutionInternalTimeServiceManager<K> extends Object implements InternalTimeServiceManager<K>, KeyedStateBackend.KeySelectionListener<K>
InternalTimeServiceManager
that manages timers with a single
active key at a time. Can be used in a BATCH execution mode.InternalTimeServiceManager.Provider, InternalTimeServiceManager.ShouldStopAdvancingFn
Constructor and Description |
---|
BatchExecutionInternalTimeServiceManager(ProcessingTimeService processingTimeService) |
Modifier and Type | Method and Description |
---|---|
void |
advanceWatermark(Watermark watermark)
Advances the Watermark of all managed
timer 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,
TypeSerializer<K> keySerializer,
TypeSerializer<N> namespaceSerializer,
Triggerable<K,N> triggerable,
AsyncExecutionController<K> asyncExecutionController)
Creates an
InternalTimerServiceAsyncImpl for handling a group of timers identified by
the given name . |
<N> InternalTimerService<N> |
getInternalTimerService(String name,
TypeSerializer<K> keySerializer,
TypeSerializer<N> namespaceSerializer,
Triggerable<K,N> triggerable)
Creates an
InternalTimerService for handling a group of timers identified by the
given name . |
void |
keySelected(K newKey)
Callback when key context is switched.
|
void |
snapshotToRawKeyedState(KeyedStateCheckpointOutputStream context,
String operatorName)
Snapshots the timers to raw keyed state.
|
boolean |
tryAdvanceWatermark(Watermark watermark,
InternalTimeServiceManager.ShouldStopAdvancingFn shouldStopAdvancingFn)
Try to
InternalTimeServiceManager.advanceWatermark(Watermark) , but if InternalTimeServiceManager.ShouldStopAdvancingFn returns
true , stop the advancement and return as soon as possible. |
public BatchExecutionInternalTimeServiceManager(ProcessingTimeService processingTimeService)
public <N> InternalTimerService<N> getInternalTimerService(String name, TypeSerializer<K> keySerializer, TypeSerializer<N> namespaceSerializer, Triggerable<K,N> triggerable)
InternalTimeServiceManager
InternalTimerService
for handling a group of timers identified by the
given name
. The timers are scoped to a key and namespace.
When a timer fires the given Triggerable
will be invoked.
getInternalTimerService
in interface InternalTimeServiceManager<K>
public <N> InternalTimerService<N> getAsyncInternalTimerService(String name, TypeSerializer<K> keySerializer, TypeSerializer<N> namespaceSerializer, Triggerable<K,N> triggerable, AsyncExecutionController<K> asyncExecutionController)
InternalTimeServiceManager
InternalTimerServiceAsyncImpl
for handling a group of timers identified by
the given name
. The timers are scoped to a key and namespace. Mainly used by async
operators.
Some essential order preservation will be added when the given Triggerable
is
invoked.
getAsyncInternalTimerService
in interface InternalTimeServiceManager<K>
public void advanceWatermark(Watermark watermark)
InternalTimeServiceManager
timer services
,
potentially firing event time timers.advanceWatermark
in interface InternalTimeServiceManager<K>
public boolean tryAdvanceWatermark(Watermark watermark, InternalTimeServiceManager.ShouldStopAdvancingFn shouldStopAdvancingFn)
InternalTimeServiceManager
InternalTimeServiceManager.advanceWatermark(Watermark)
, but if InternalTimeServiceManager.ShouldStopAdvancingFn
returns
true
, stop the advancement and return as soon as possible.tryAdvanceWatermark
in interface InternalTimeServiceManager<K>
Watermark
has been fully processed, false otherwise.public void snapshotToRawKeyedState(KeyedStateCheckpointOutputStream context, String operatorName) throws Exception
InternalTimeServiceManager
TODO: This can be removed once heap-based timers are integrated with RocksDB incremental snapshots.
snapshotToRawKeyedState
in interface InternalTimeServiceManager<K>
Exception
public static <K> InternalTimeServiceManager<K> create(TaskIOMetricGroup taskIOMetricGroup, CheckpointableKeyedStateBackend<K> keyedStatedBackend, ClassLoader userClassloader, KeyContext keyContext, ProcessingTimeService processingTimeService, Iterable<KeyGroupStatePartitionStreamProvider> rawKeyedStates, StreamTaskCancellationContext cancellationContext)
public void keySelected(K newKey)
KeyedStateBackend.KeySelectionListener
keySelected
in interface KeyedStateBackend.KeySelectionListener<K>
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.