本文整理汇总了Java中org.apache.flink.runtime.state.OperatorStateBackend类的典型用法代码示例。如果您正苦于以下问题:Java OperatorStateBackend类的具体用法?Java OperatorStateBackend怎么用?Java OperatorStateBackend使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OperatorStateBackend类属于org.apache.flink.runtime.state包,在下文中一共展示了OperatorStateBackend类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: AbstractBroadcastState
import org.apache.flink.runtime.state.OperatorStateBackend; //导入依赖的package包/类
AbstractBroadcastState(
OperatorStateBackend flinkStateBackend,
String name,
StateNamespace namespace,
Coder<T> coder) {
this.name = name;
this.namespace = namespace;
this.flinkStateBackend = flinkStateBackend;
CoderTypeInformation<Map<String, T>> typeInfo =
new CoderTypeInformation<>(MapCoder.of(StringUtf8Coder.of(), coder));
flinkStateDescriptor = new ListStateDescriptor<>(name,
typeInfo.createSerializer(new ExecutionConfig()));
}
示例2: FlinkCombiningStateWithContext
import org.apache.flink.runtime.state.OperatorStateBackend; //导入依赖的package包/类
FlinkCombiningStateWithContext(
OperatorStateBackend flinkStateBackend,
StateTag<CombiningState<InputT, AccumT, OutputT>> address,
CombineWithContext.CombineFnWithContext<InputT, AccumT, OutputT> combineFn,
StateNamespace namespace,
Coder<AccumT> accumCoder,
FlinkBroadcastStateInternals<K> flinkStateInternals,
CombineWithContext.Context context) {
super(flinkStateBackend, address.getId(), namespace, accumCoder);
this.namespace = namespace;
this.address = address;
this.combineFn = combineFn;
this.flinkStateInternals = flinkStateInternals;
this.context = context;
}
示例3: snapshotFunctionState
import org.apache.flink.runtime.state.OperatorStateBackend; //导入依赖的package包/类
public static void snapshotFunctionState(
StateSnapshotContext context,
OperatorStateBackend backend,
Function userFunction) throws Exception {
Preconditions.checkNotNull(context);
Preconditions.checkNotNull(backend);
while (true) {
if (trySnapshotFunctionState(context, backend, userFunction)) {
break;
}
// inspect if the user function is wrapped, then unwrap and try again if we can snapshot the inner function
if (userFunction instanceof WrappingFunction) {
userFunction = ((WrappingFunction<?>) userFunction).getWrappedFunction();
} else {
break;
}
}
}
示例4: createOperatorStateBackend
import org.apache.flink.runtime.state.OperatorStateBackend; //导入依赖的package包/类
public OperatorStateBackend createOperatorStateBackend(
StreamOperator<?> op, Collection<OperatorStateHandle> restoreStateHandles) throws Exception {
Environment env = getEnvironment();
String opId = createOperatorIdentifier(op, getConfiguration().getVertexID());
OperatorStateBackend operatorStateBackend = stateBackend.createOperatorStateBackend(env, opId);
// let operator state backend participate in the operator lifecycle, i.e. make it responsive to cancelation
cancelables.registerCloseable(operatorStateBackend);
// restore if we have some old state
if (null != restoreStateHandles) {
operatorStateBackend.restore(restoreStateHandles);
}
return operatorStateBackend;
}
示例5: createOperatorStateBackend
import org.apache.flink.runtime.state.OperatorStateBackend; //导入依赖的package包/类
@Override
public OperatorStateBackend createOperatorStateBackend(Environment env, String operatorIdentifier) throws Exception {
return new DefaultOperatorStateBackend(
env.getUserClassLoader(),
env.getExecutionConfig(),
true) {
@Override
public RunnableFuture<OperatorStateHandle> snapshot(
long checkpointId,
long timestamp,
CheckpointStreamFactory streamFactory,
CheckpointOptions checkpointOptions) throws Exception {
throw new Exception("Sync part snapshot exception.");
}
};
}
示例6: FlinkSplitBagState
import org.apache.flink.runtime.state.OperatorStateBackend; //导入依赖的package包/类
FlinkSplitBagState(
OperatorStateBackend flinkStateBackend,
StateTag<BagState<T>> address,
StateNamespace namespace,
Coder<T> coder) {
this.flinkStateBackend = flinkStateBackend;
this.namespace = namespace;
this.address = address;
CoderTypeInformation<T> typeInfo =
new CoderTypeInformation<>(coder);
descriptor = new ListStateDescriptor<>(address.getId(),
typeInfo.createSerializer(new ExecutionConfig()));
}
示例7: FlinkBroadcastStateInternals
import org.apache.flink.runtime.state.OperatorStateBackend; //导入依赖的package包/类
public FlinkBroadcastStateInternals(int indexInSubtaskGroup, OperatorStateBackend stateBackend) {
this.stateBackend = stateBackend;
this.indexInSubtaskGroup = indexInSubtaskGroup;
if (indexInSubtaskGroup != 0) {
stateForNonZeroOperator = new HashMap<>();
}
}
示例8: FlinkBroadcastValueState
import org.apache.flink.runtime.state.OperatorStateBackend; //导入依赖的package包/类
FlinkBroadcastValueState(
OperatorStateBackend flinkStateBackend,
StateTag<ValueState<T>> address,
StateNamespace namespace,
Coder<T> coder) {
super(flinkStateBackend, address.getId(), namespace, coder);
this.namespace = namespace;
this.address = address;
}
示例9: FlinkBroadcastBagState
import org.apache.flink.runtime.state.OperatorStateBackend; //导入依赖的package包/类
FlinkBroadcastBagState(
OperatorStateBackend flinkStateBackend,
StateTag<BagState<T>> address,
StateNamespace namespace,
Coder<T> coder) {
super(flinkStateBackend, address.getId(), namespace, ListCoder.of(coder));
this.namespace = namespace;
this.address = address;
}
示例10: FlinkCombiningState
import org.apache.flink.runtime.state.OperatorStateBackend; //导入依赖的package包/类
FlinkCombiningState(
OperatorStateBackend flinkStateBackend,
StateTag<CombiningState<InputT, AccumT, OutputT>> address,
Combine.CombineFn<InputT, AccumT, OutputT> combineFn,
StateNamespace namespace,
Coder<AccumT> accumCoder) {
super(flinkStateBackend, address.getId(), namespace, accumCoder);
this.namespace = namespace;
this.address = address;
this.combineFn = combineFn;
}
示例11: FlinkKeyedCombiningState
import org.apache.flink.runtime.state.OperatorStateBackend; //导入依赖的package包/类
FlinkKeyedCombiningState(
OperatorStateBackend flinkStateBackend,
StateTag<CombiningState<InputT, AccumT, OutputT>> address,
Combine.CombineFn<InputT, AccumT, OutputT> combineFn,
StateNamespace namespace,
Coder<AccumT> accumCoder,
FlinkBroadcastStateInternals<K> flinkStateInternals) {
super(flinkStateBackend, address.getId(), namespace, accumCoder);
this.namespace = namespace;
this.address = address;
this.combineFn = combineFn;
this.flinkStateInternals = flinkStateInternals;
}
示例12: createStateInternals
import org.apache.flink.runtime.state.OperatorStateBackend; //导入依赖的package包/类
@Override
protected StateInternals createStateInternals() {
MemoryStateBackend backend = new MemoryStateBackend();
try {
OperatorStateBackend operatorStateBackend =
backend.createOperatorStateBackend(new DummyEnvironment("test", 1, 0), "");
return new FlinkSplitStateInternals<>(operatorStateBackend);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例13: createStateInternals
import org.apache.flink.runtime.state.OperatorStateBackend; //导入依赖的package包/类
@Override
protected StateInternals createStateInternals() {
MemoryStateBackend backend = new MemoryStateBackend();
try {
OperatorStateBackend operatorStateBackend =
backend.createOperatorStateBackend(new DummyEnvironment("test", 1, 0), "");
return new FlinkBroadcastStateInternals<>(1, operatorStateBackend);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例14: createOperatorStateBackend
import org.apache.flink.runtime.state.OperatorStateBackend; //导入依赖的package包/类
@Override
public OperatorStateBackend createOperatorStateBackend(
Environment env,
String operatorIdentifier) throws Exception {
throw new UnsupportedOperationException();
}
示例15: createOperatorStateBackend
import org.apache.flink.runtime.state.OperatorStateBackend; //导入依赖的package包/类
@Override
public OperatorStateBackend createOperatorStateBackend(
Environment env,
String operatorIdentifier) throws Exception {
//the default for RocksDB; eventually there can be a operator state backend based on RocksDB, too.
final boolean asyncSnapshots = true;
return new DefaultOperatorStateBackend(
env.getUserClassLoader(),
env.getExecutionConfig(),
asyncSnapshots);
}