K - The type of keys used for the timers and the registry.@Internal public class InternalTimeServiceManagerImpl<K> extends Object implements InternalTimeServiceManager<K>
timer services.
NOTE: These services are only available to keyed operators.
InternalTimeServiceManager.Provider, InternalTimeServiceManager.ShouldStopAdvancingFn| Modifier and Type | Field and Description |
|---|---|
protected static org.slf4j.Logger |
LOG |
| 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> InternalTimeServiceManagerImpl<K> |
create(org.apache.flink.runtime.metrics.groups.TaskIOMetricGroup taskIOMetricGroup,
org.apache.flink.runtime.state.CheckpointableKeyedStateBackend<K> keyedStateBackend,
ClassLoader userClassloader,
KeyContext keyContext,
ProcessingTimeService processingTimeService,
Iterable<org.apache.flink.runtime.state.KeyGroupStatePartitionStreamProvider> rawKeyedStates,
StreamTaskCancellationContext cancellationContext)
A factory method for creating the
InternalTimeServiceManagerImpl. |
<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,
org.apache.flink.runtime.asyncprocessing.AsyncExecutionController<K> asyncExecutionController)
Creates an
InternalTimerServiceAsyncImpl for handling a group of timers identified by
the given name. |
<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 an
InternalTimerService for handling a group of timers identified by the
given name. |
int |
numEventTimeTimers() |
int |
numProcessingTimeTimers() |
void |
snapshotToRawKeyedState(org.apache.flink.runtime.state.KeyedStateCheckpointOutputStream out,
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 static <K> InternalTimeServiceManagerImpl<K> create(org.apache.flink.runtime.metrics.groups.TaskIOMetricGroup taskIOMetricGroup, org.apache.flink.runtime.state.CheckpointableKeyedStateBackend<K> keyedStateBackend, ClassLoader userClassloader, KeyContext keyContext, ProcessingTimeService processingTimeService, Iterable<org.apache.flink.runtime.state.KeyGroupStatePartitionStreamProvider> rawKeyedStates, StreamTaskCancellationContext cancellationContext) throws Exception
InternalTimeServiceManagerImpl.
IMPORTANT: Keep in sync with InternalTimeServiceManager.Provider.
Exceptionpublic <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)
InternalTimeServiceManagerInternalTimerService 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, org.apache.flink.api.common.typeutils.TypeSerializer<K> keySerializer, org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer, Triggerable<K,N> triggerable, org.apache.flink.runtime.asyncprocessing.AsyncExecutionController<K> asyncExecutionController)
InternalTimeServiceManagerInternalTimerServiceAsyncImpl 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) throws Exception
InternalTimeServiceManagertimer services,
potentially firing event time timers.advanceWatermark in interface InternalTimeServiceManager<K>Exceptionpublic boolean tryAdvanceWatermark(Watermark watermark, InternalTimeServiceManager.ShouldStopAdvancingFn shouldStopAdvancingFn) throws Exception
InternalTimeServiceManagerInternalTimeServiceManager.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.Exceptionpublic void snapshotToRawKeyedState(org.apache.flink.runtime.state.KeyedStateCheckpointOutputStream out,
String operatorName)
throws Exception
InternalTimeServiceManagerTODO: This can be removed once heap-based timers are integrated with RocksDB incremental snapshots.
snapshotToRawKeyedState in interface InternalTimeServiceManager<K>Exception@VisibleForTesting public int numProcessingTimeTimers()
@VisibleForTesting public int numEventTimeTimers()
Copyright © 2014–2025 The Apache Software Foundation. All rights reserved.