public class StreamTaskStateInitializerImpl extends Object implements StreamTaskStateInitializer
StreamTaskStateInitializer
. This class obtains
the state to create StreamOperatorStateContext
objects for stream operators from the
TaskStateManager
of the task that runs the stream task and hence the operator.
This implementation operates on top a TaskStateManager
, from which it receives
everything required to restore state in the backends from checkpoints or savepoints.
Constructor and Description |
---|
StreamTaskStateInitializerImpl(Environment environment,
StateBackend stateBackend) |
StreamTaskStateInitializerImpl(Environment environment,
StateBackend stateBackend,
TtlTimeProvider ttlTimeProvider) |
public StreamTaskStateInitializerImpl(Environment environment, StateBackend stateBackend)
@VisibleForTesting public StreamTaskStateInitializerImpl(Environment environment, StateBackend stateBackend, TtlTimeProvider ttlTimeProvider)
public StreamOperatorStateContext streamOperatorStateContext(@Nonnull OperatorID operatorID, @Nonnull String operatorClassName, @Nonnull ProcessingTimeService processingTimeService, @Nonnull KeyContext keyContext, @Nullable TypeSerializer<?> keySerializer, @Nonnull CloseableRegistry streamTaskCloseableRegistry, @Nonnull MetricGroup metricGroup, boolean isUsingCustomRawKeyedState) throws Exception
StreamTaskStateInitializer
StreamOperatorStateContext
for an AbstractStreamOperator
that
runs in the stream task that owns this manager.streamOperatorStateContext
in interface StreamTaskStateInitializer
operatorID
- the id of the operator for which the context is created. Cannot be null.operatorClassName
- the classname of the operator instance for which the context is
created. Cannot be null.keyContext
- the key context of the operator instance for which the context is created
Cannot be null.keySerializer
- the key-serializer for the operator. Can be null.streamTaskCloseableRegistry
- the closeable registry to which created closeable objects
will be registered.metricGroup
- the parent metric group for all statebackend metricsisUsingCustomRawKeyedState
- flag indicating whether or not the AbstractStreamOperator
is writing custom raw keyed state.Exception
- when something went wrong while creating the context.protected <K> InternalTimeServiceManager<K> internalTimeServiceManager(AbstractKeyedStateBackend<K> keyedStatedBackend, KeyContext keyContext, ProcessingTimeService processingTimeService, Iterable<KeyGroupStatePartitionStreamProvider> rawKeyedStates) throws Exception
Exception
protected OperatorStateBackend operatorStateBackend(String operatorIdentifierText, PrioritizedOperatorSubtaskState prioritizedOperatorSubtaskStates, CloseableRegistry backendCloseableRegistry) throws Exception
Exception
protected <K> AbstractKeyedStateBackend<K> keyedStatedBackend(TypeSerializer<K> keySerializer, String operatorIdentifierText, PrioritizedOperatorSubtaskState prioritizedOperatorSubtaskStates, CloseableRegistry backendCloseableRegistry, MetricGroup metricGroup) throws Exception
Exception
protected CloseableIterable<StatePartitionStreamProvider> rawOperatorStateInputs(Iterator<StateObjectCollection<OperatorStateHandle>> restoreStateAlternatives)
protected CloseableIterable<KeyGroupStatePartitionStreamProvider> rawKeyedStateInputs(Iterator<StateObjectCollection<KeyedStateHandle>> restoreStateAlternatives)
Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.