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.AbstractRuntimeUDFContext
Implementation of the RuntimeContext, 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

    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(org.apache.flink.api.common.state.v2.AggregatingStateDescriptor<IN,ACC,OUT> stateProperties)
     
    <RT> List<RT>
     
    <T, C> C
    getBroadcastVariableWithInitializer(String name, org.apache.flink.api.common.functions.BroadcastVariableInitializer<T,C> initializer)
     
    Set<org.apache.flink.api.common.externalresource.ExternalResourceInfo>
     
    Returns the global aggregate manager for the current job.
    Returns the input split provider associated with the operator.
    org.apache.flink.configuration.Configuration
     
     
    <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(org.apache.flink.api.common.state.v2.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(org.apache.flink.api.common.state.v2.MapStateDescriptor<UK,UV> stateProperties)
     
    Returned value is guaranteed to be unique between operators within the same job and to be stable and the same across job submissions.
     
    <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(org.apache.flink.api.common.state.v2.ReducingStateDescriptor<T> stateProperties)
     
    <T> org.apache.flink.api.common.state.v2.ValueState<T>
    getState(org.apache.flink.api.common.state.v2.ValueStateDescriptor<T> stateProperties)
     
    <T> org.apache.flink.api.common.state.ValueState<T>
    getState(org.apache.flink.api.common.state.ValueStateDescriptor<T> stateProperties)
     
    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(org.apache.flink.api.common.state.v2.ValueStateDescriptor<T> stateProperties)
     
    boolean
     
    boolean
    Returns true if checkpointing is enabled for the running job.
    void
    setKeyedStateStore(org.apache.flink.api.common.state.KeyedStateStore keyedStateStore)
     

    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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • 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 Details

    • setKeyedStateStore

      public void setKeyedStateStore(@Nullable org.apache.flink.api.common.state.KeyedStateStore keyedStateStore)
    • 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)
    • getBroadcastVariable

      public <RT> List<RT> getBroadcastVariable(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:
      getState in interface org.apache.flink.api.common.functions.RuntimeContext
      Overrides:
      getState in class org.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:
      getListState in interface org.apache.flink.api.common.functions.RuntimeContext
      Overrides:
      getListState in class org.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:
      getReducingState in interface org.apache.flink.api.common.functions.RuntimeContext
      Overrides:
      getReducingState in class org.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:
      getAggregatingState in interface org.apache.flink.api.common.functions.RuntimeContext
      Overrides:
      getAggregatingState in class org.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:
      getMapState in interface org.apache.flink.api.common.functions.RuntimeContext
      Overrides:
      getMapState in class org.apache.flink.api.common.functions.util.AbstractRuntimeUDFContext
    • getState

      public <T> org.apache.flink.api.common.state.v2.ValueState<T> getState(org.apache.flink.api.common.state.v2.ValueStateDescriptor<T> stateProperties)
      Specified by:
      getState in interface org.apache.flink.api.common.functions.RuntimeContext
      Overrides:
      getState in class org.apache.flink.api.common.functions.util.AbstractRuntimeUDFContext
    • getValueState

      public <T> org.apache.flink.api.common.state.v2.ValueState<T> getValueState(org.apache.flink.api.common.state.v2.ValueStateDescriptor<T> stateProperties)
    • getListState

      public <T> org.apache.flink.api.common.state.v2.ListState<T> getListState(org.apache.flink.api.common.state.v2.ListStateDescriptor<T> stateProperties)
      Specified by:
      getListState in interface org.apache.flink.api.common.functions.RuntimeContext
      Overrides:
      getListState in class org.apache.flink.api.common.functions.util.AbstractRuntimeUDFContext
    • getMapState

      public <UK, UV> org.apache.flink.api.common.state.v2.MapState<UK,UV> getMapState(org.apache.flink.api.common.state.v2.MapStateDescriptor<UK,UV> stateProperties)
      Specified by:
      getMapState in interface org.apache.flink.api.common.functions.RuntimeContext
      Overrides:
      getMapState in class org.apache.flink.api.common.functions.util.AbstractRuntimeUDFContext
    • getReducingState

      public <T> org.apache.flink.api.common.state.v2.ReducingState<T> getReducingState(org.apache.flink.api.common.state.v2.ReducingStateDescriptor<T> stateProperties)
      Specified by:
      getReducingState in interface org.apache.flink.api.common.functions.RuntimeContext
      Overrides:
      getReducingState in class org.apache.flink.api.common.functions.util.AbstractRuntimeUDFContext
    • getAggregatingState

      public <IN, ACC, OUT> org.apache.flink.api.common.state.v2.AggregatingState<IN,OUT> getAggregatingState(org.apache.flink.api.common.state.v2.AggregatingStateDescriptor<IN,ACC,OUT> stateProperties)
      Specified by:
      getAggregatingState in interface org.apache.flink.api.common.functions.RuntimeContext
      Overrides:
      getAggregatingState in class org.apache.flink.api.common.functions.util.AbstractRuntimeUDFContext
    • isCheckpointingEnabled

      public boolean isCheckpointingEnabled()
      Returns true if checkpointing is enabled for the running job.
      Returns:
      true if checkpointing is enabled.