Class StreamingRuntimeContext
- java.lang.Object
-
- org.apache.flink.api.common.functions.util.AbstractRuntimeUDFContext
-
- org.apache.flink.streaming.api.operators.StreamingRuntimeContext
-
- All Implemented Interfaces:
org.apache.flink.api.common.functions.RuntimeContext
@Internal public class StreamingRuntimeContext extends org.apache.flink.api.common.functions.util.AbstractRuntimeUDFContextImplementation of theRuntimeContext, for streaming operators.
-
-
Constructor Summary
Constructors Constructor Description StreamingRuntimeContext(Environment env, Map<String,org.apache.flink.api.common.accumulators.Accumulator<?,?>> accumulators, org.apache.flink.metrics.groups.OperatorMetricGroup operatorMetricGroup, OperatorID operatorID, ProcessingTimeService processingTimeService, org.apache.flink.api.common.state.KeyedStateStore keyedStateStore, ExternalResourceInfoProvider externalResourceInfoProvider)StreamingRuntimeContext(AbstractStreamOperator<?> operator, Environment env, Map<String,org.apache.flink.api.common.accumulators.Accumulator<?,?>> accumulators)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <IN,ACC,OUT>
org.apache.flink.api.common.state.AggregatingState<IN,OUT>getAggregatingState(org.apache.flink.api.common.state.AggregatingStateDescriptor<IN,ACC,OUT> stateProperties)<IN,ACC,OUT>
org.apache.flink.api.common.state.v2.AggregatingState<IN,OUT>getAggregatingState(AggregatingStateDescriptor<IN,ACC,OUT> stateProperties)<RT> List<RT>getBroadcastVariable(String name)<T,C>
CgetBroadcastVariableWithInitializer(String name, org.apache.flink.api.common.functions.BroadcastVariableInitializer<T,C> initializer)Set<org.apache.flink.api.common.externalresource.ExternalResourceInfo>getExternalResourceInfos(String resourceName)GlobalAggregateManagergetGlobalAggregateManager()Returns the global aggregate manager for the current job.InputSplitProvidergetInputSplitProvider()Returns the input split provider associated with the operator.org.apache.flink.configuration.ConfigurationgetJobConfiguration()JobTypegetJobType()<T> org.apache.flink.api.common.state.ListState<T>getListState(org.apache.flink.api.common.state.ListStateDescriptor<T> stateProperties)<T> org.apache.flink.api.common.state.v2.ListState<T>getListState(ListStateDescriptor<T> stateProperties)<UK,UV>
org.apache.flink.api.common.state.MapState<UK,UV>getMapState(org.apache.flink.api.common.state.MapStateDescriptor<UK,UV> stateProperties)<UK,UV>
org.apache.flink.api.common.state.v2.MapState<UK,UV>getMapState(MapStateDescriptor<UK,UV> stateProperties)StringgetOperatorUniqueID()Returned value is guaranteed to be unique between operators within the same job and to be stable and the same across job submissions.ProcessingTimeServicegetProcessingTimeService()<T> org.apache.flink.api.common.state.ReducingState<T>getReducingState(org.apache.flink.api.common.state.ReducingStateDescriptor<T> stateProperties)<T> org.apache.flink.api.common.state.v2.ReducingState<T>getReducingState(ReducingStateDescriptor<T> stateProperties)<T> org.apache.flink.api.common.state.ValueState<T>getState(org.apache.flink.api.common.state.ValueStateDescriptor<T> stateProperties)TaskManagerRuntimeInfogetTaskManagerRuntimeInfo()Returns the task manager runtime info of the task manager running this stream task.<T> org.apache.flink.api.common.state.v2.ValueState<T>getValueState(ValueStateDescriptor<T> stateProperties)booleanhasBroadcastVariable(String name)booleanisCheckpointingEnabled()Returns true if checkpointing is enabled for the running job.voidsetKeyedStateStore(org.apache.flink.api.common.state.KeyedStateStore keyedStateStore)voidsetKeyedStateStoreV2(KeyedStateStoreV2 keyedStateStoreV2)-
Methods inherited from class org.apache.flink.api.common.functions.util.AbstractRuntimeUDFContext
addAccumulator, createSerializer, getAccumulator, getAllocationIDAsString, getDistributedCache, getDoubleCounter, getGlobalJobParameters, getHistogram, getIntCounter, getJobInfo, getLongCounter, getMetricGroup, getTaskInfo, getUserCodeClassLoader, isObjectReuseEnabled, registerUserCodeClassLoaderReleaseHookIfAbsent
-
-
-
-
Constructor Detail
-
StreamingRuntimeContext
@VisibleForTesting public StreamingRuntimeContext(AbstractStreamOperator<?> operator, Environment env, Map<String,org.apache.flink.api.common.accumulators.Accumulator<?,?>> accumulators)
-
StreamingRuntimeContext
public StreamingRuntimeContext(Environment env, Map<String,org.apache.flink.api.common.accumulators.Accumulator<?,?>> accumulators, org.apache.flink.metrics.groups.OperatorMetricGroup operatorMetricGroup, OperatorID operatorID, ProcessingTimeService processingTimeService, @Nullable org.apache.flink.api.common.state.KeyedStateStore keyedStateStore, ExternalResourceInfoProvider externalResourceInfoProvider)
-
-
Method Detail
-
setKeyedStateStore
public void setKeyedStateStore(@Nullable org.apache.flink.api.common.state.KeyedStateStore keyedStateStore)
-
setKeyedStateStoreV2
public void setKeyedStateStoreV2(@Nullable KeyedStateStoreV2 keyedStateStoreV2)
-
getInputSplitProvider
public InputSplitProvider getInputSplitProvider()
Returns the input split provider associated with the operator.- Returns:
- The input split provider.
-
getProcessingTimeService
public ProcessingTimeService getProcessingTimeService()
-
getGlobalAggregateManager
public GlobalAggregateManager getGlobalAggregateManager()
Returns the global aggregate manager for the current job.- Returns:
- The global aggregate manager.
-
getOperatorUniqueID
public String getOperatorUniqueID()
Returned value is guaranteed to be unique between operators within the same job and to be stable and the same across job submissions.This operation is currently only supported in Streaming (DataStream) contexts.
- Returns:
- String representation of the operator's unique id.
-
getTaskManagerRuntimeInfo
public TaskManagerRuntimeInfo getTaskManagerRuntimeInfo()
Returns the task manager runtime info of the task manager running this stream task.- Returns:
- The task manager runtime info.
-
getJobConfiguration
public org.apache.flink.configuration.Configuration getJobConfiguration()
-
getJobType
public JobType getJobType()
-
getExternalResourceInfos
public Set<org.apache.flink.api.common.externalresource.ExternalResourceInfo> getExternalResourceInfos(String resourceName)
-
hasBroadcastVariable
public boolean hasBroadcastVariable(String name)
-
getBroadcastVariableWithInitializer
public <T,C> C getBroadcastVariableWithInitializer(String name, org.apache.flink.api.common.functions.BroadcastVariableInitializer<T,C> initializer)
-
getState
public <T> org.apache.flink.api.common.state.ValueState<T> getState(org.apache.flink.api.common.state.ValueStateDescriptor<T> stateProperties)
- Specified by:
getStatein interfaceorg.apache.flink.api.common.functions.RuntimeContext- Overrides:
getStatein classorg.apache.flink.api.common.functions.util.AbstractRuntimeUDFContext
-
getListState
public <T> org.apache.flink.api.common.state.ListState<T> getListState(org.apache.flink.api.common.state.ListStateDescriptor<T> stateProperties)
- Specified by:
getListStatein interfaceorg.apache.flink.api.common.functions.RuntimeContext- Overrides:
getListStatein classorg.apache.flink.api.common.functions.util.AbstractRuntimeUDFContext
-
getReducingState
public <T> org.apache.flink.api.common.state.ReducingState<T> getReducingState(org.apache.flink.api.common.state.ReducingStateDescriptor<T> stateProperties)
- Specified by:
getReducingStatein interfaceorg.apache.flink.api.common.functions.RuntimeContext- Overrides:
getReducingStatein classorg.apache.flink.api.common.functions.util.AbstractRuntimeUDFContext
-
getAggregatingState
public <IN,ACC,OUT> org.apache.flink.api.common.state.AggregatingState<IN,OUT> getAggregatingState(org.apache.flink.api.common.state.AggregatingStateDescriptor<IN,ACC,OUT> stateProperties)
- Specified by:
getAggregatingStatein interfaceorg.apache.flink.api.common.functions.RuntimeContext- Overrides:
getAggregatingStatein classorg.apache.flink.api.common.functions.util.AbstractRuntimeUDFContext
-
getMapState
public <UK,UV> org.apache.flink.api.common.state.MapState<UK,UV> getMapState(org.apache.flink.api.common.state.MapStateDescriptor<UK,UV> stateProperties)
- Specified by:
getMapStatein interfaceorg.apache.flink.api.common.functions.RuntimeContext- Overrides:
getMapStatein classorg.apache.flink.api.common.functions.util.AbstractRuntimeUDFContext
-
getValueState
public <T> org.apache.flink.api.common.state.v2.ValueState<T> getValueState(ValueStateDescriptor<T> stateProperties)
-
getListState
public <T> org.apache.flink.api.common.state.v2.ListState<T> getListState(ListStateDescriptor<T> stateProperties)
-
getMapState
public <UK,UV> org.apache.flink.api.common.state.v2.MapState<UK,UV> getMapState(MapStateDescriptor<UK,UV> stateProperties)
-
getReducingState
public <T> org.apache.flink.api.common.state.v2.ReducingState<T> getReducingState(ReducingStateDescriptor<T> stateProperties)
-
getAggregatingState
public <IN,ACC,OUT> org.apache.flink.api.common.state.v2.AggregatingState<IN,OUT> getAggregatingState(AggregatingStateDescriptor<IN,ACC,OUT> stateProperties)
-
isCheckpointingEnabled
public boolean isCheckpointingEnabled()
Returns true if checkpointing is enabled for the running job.- Returns:
- true if checkpointing is enabled.
-
-