Class DefaultStateManager
- java.lang.Object
-
- org.apache.flink.datastream.impl.context.DefaultStateManager
-
- All Implemented Interfaces:
org.apache.flink.datastream.api.context.StateManager
public class DefaultStateManager extends Object implements org.apache.flink.datastream.api.context.StateManager
The default implementation ofStateManager. This class supports eagerly set and reset the current key.
-
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.flink.streaming.api.operators.StreamingRuntimeContextoperatorContextprotected org.apache.flink.api.common.state.OperatorStateStoreoperatorStateStore
-
Constructor Summary
Constructors Constructor Description DefaultStateManager(Supplier<Object> currentKeySupplier, BiConsumer<Runnable,Object> processorWithKey, org.apache.flink.streaming.api.operators.StreamingRuntimeContext operatorContext, org.apache.flink.api.common.state.OperatorStateStore operatorStateStore)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidexecuteInKeyContext(Runnable runnable, Object key)This method should be used to run a block of code with a specific key context.<K> KgetCurrentKey()<IN,ACC,OUT>
org.apache.flink.api.common.state.v2.AggregatingState<IN,OUT>getState(org.apache.flink.api.common.state.AggregatingStateDeclaration<IN,ACC,OUT> stateDeclaration)<K,V>
org.apache.flink.api.common.state.BroadcastState<K,V>getState(org.apache.flink.api.common.state.BroadcastStateDeclaration<K,V> stateDeclaration)<T> org.apache.flink.api.common.state.v2.ListState<T>getState(org.apache.flink.api.common.state.ListStateDeclaration<T> stateDeclaration)<K,V>
org.apache.flink.api.common.state.v2.MapState<K,V>getState(org.apache.flink.api.common.state.MapStateDeclaration<K,V> stateDeclaration)<T> org.apache.flink.api.common.state.v2.ReducingState<T>getState(org.apache.flink.api.common.state.ReducingStateDeclaration<T> stateDeclaration)<T> org.apache.flink.api.common.state.v2.ValueState<T>getState(org.apache.flink.api.common.state.ValueStateDeclaration<T> stateDeclaration)<IN,ACC,OUT>
Optional<org.apache.flink.api.common.state.v2.AggregatingState<IN,OUT>>getStateOptional(org.apache.flink.api.common.state.AggregatingStateDeclaration<IN,ACC,OUT> stateDeclaration)<K,V>
Optional<org.apache.flink.api.common.state.BroadcastState<K,V>>getStateOptional(org.apache.flink.api.common.state.BroadcastStateDeclaration<K,V> stateDeclaration)<T> Optional<org.apache.flink.api.common.state.v2.ListState<T>>getStateOptional(org.apache.flink.api.common.state.ListStateDeclaration<T> stateDeclaration)<K,V>
Optional<org.apache.flink.api.common.state.v2.MapState<K,V>>getStateOptional(org.apache.flink.api.common.state.MapStateDeclaration<K,V> stateDeclaration)<T> Optional<org.apache.flink.api.common.state.v2.ReducingState<T>>getStateOptional(org.apache.flink.api.common.state.ReducingStateDeclaration<T> stateDeclaration)<T> Optional<org.apache.flink.api.common.state.v2.ValueState<T>>getStateOptional(org.apache.flink.api.common.state.ValueStateDeclaration<T> stateDeclaration)
-
-
-
Constructor Detail
-
DefaultStateManager
public DefaultStateManager(Supplier<Object> currentKeySupplier, BiConsumer<Runnable,Object> processorWithKey, org.apache.flink.streaming.api.operators.StreamingRuntimeContext operatorContext, org.apache.flink.api.common.state.OperatorStateStore operatorStateStore)
-
-
Method Detail
-
getCurrentKey
public <K> K getCurrentKey()
- Specified by:
getCurrentKeyin interfaceorg.apache.flink.datastream.api.context.StateManager
-
getStateOptional
public <T> Optional<org.apache.flink.api.common.state.v2.ValueState<T>> getStateOptional(org.apache.flink.api.common.state.ValueStateDeclaration<T> stateDeclaration) throws Exception
- Specified by:
getStateOptionalin interfaceorg.apache.flink.datastream.api.context.StateManager- Throws:
Exception
-
getState
public <T> org.apache.flink.api.common.state.v2.ValueState<T> getState(org.apache.flink.api.common.state.ValueStateDeclaration<T> stateDeclaration) throws Exception- Specified by:
getStatein interfaceorg.apache.flink.datastream.api.context.StateManager- Throws:
Exception
-
getStateOptional
public <T> Optional<org.apache.flink.api.common.state.v2.ListState<T>> getStateOptional(org.apache.flink.api.common.state.ListStateDeclaration<T> stateDeclaration) throws Exception
- Specified by:
getStateOptionalin interfaceorg.apache.flink.datastream.api.context.StateManager- Throws:
Exception
-
getState
public <T> org.apache.flink.api.common.state.v2.ListState<T> getState(org.apache.flink.api.common.state.ListStateDeclaration<T> stateDeclaration) throws Exception- Specified by:
getStatein interfaceorg.apache.flink.datastream.api.context.StateManager- Throws:
Exception
-
getStateOptional
public <K,V> Optional<org.apache.flink.api.common.state.v2.MapState<K,V>> getStateOptional(org.apache.flink.api.common.state.MapStateDeclaration<K,V> stateDeclaration) throws Exception
- Specified by:
getStateOptionalin interfaceorg.apache.flink.datastream.api.context.StateManager- Throws:
Exception
-
getState
public <K,V> org.apache.flink.api.common.state.v2.MapState<K,V> getState(org.apache.flink.api.common.state.MapStateDeclaration<K,V> stateDeclaration) throws Exception- Specified by:
getStatein interfaceorg.apache.flink.datastream.api.context.StateManager- Throws:
Exception
-
getStateOptional
public <T> Optional<org.apache.flink.api.common.state.v2.ReducingState<T>> getStateOptional(org.apache.flink.api.common.state.ReducingStateDeclaration<T> stateDeclaration) throws Exception
- Specified by:
getStateOptionalin interfaceorg.apache.flink.datastream.api.context.StateManager- Throws:
Exception
-
getState
public <T> org.apache.flink.api.common.state.v2.ReducingState<T> getState(org.apache.flink.api.common.state.ReducingStateDeclaration<T> stateDeclaration) throws Exception- Specified by:
getStatein interfaceorg.apache.flink.datastream.api.context.StateManager- Throws:
Exception
-
getStateOptional
public <IN,ACC,OUT> Optional<org.apache.flink.api.common.state.v2.AggregatingState<IN,OUT>> getStateOptional(org.apache.flink.api.common.state.AggregatingStateDeclaration<IN,ACC,OUT> stateDeclaration) throws Exception
- Specified by:
getStateOptionalin interfaceorg.apache.flink.datastream.api.context.StateManager- Throws:
Exception
-
getState
public <IN,ACC,OUT> org.apache.flink.api.common.state.v2.AggregatingState<IN,OUT> getState(org.apache.flink.api.common.state.AggregatingStateDeclaration<IN,ACC,OUT> stateDeclaration) throws Exception- Specified by:
getStatein interfaceorg.apache.flink.datastream.api.context.StateManager- Throws:
Exception
-
getStateOptional
public <K,V> Optional<org.apache.flink.api.common.state.BroadcastState<K,V>> getStateOptional(org.apache.flink.api.common.state.BroadcastStateDeclaration<K,V> stateDeclaration) throws Exception
- Specified by:
getStateOptionalin interfaceorg.apache.flink.datastream.api.context.StateManager- Throws:
Exception
-
getState
public <K,V> org.apache.flink.api.common.state.BroadcastState<K,V> getState(org.apache.flink.api.common.state.BroadcastStateDeclaration<K,V> stateDeclaration) throws Exception- Specified by:
getStatein interfaceorg.apache.flink.datastream.api.context.StateManager- Throws:
Exception
-
-