use of org.apache.flink.streaming.api.operators.StreamTaskStateInitializer in project flink by apache.
the class StreamOperatorContextBuilder method build.
StreamOperatorStateContext build(Logger logger) throws IOException {
final Environment environment = new SavepointEnvironment.Builder(ctx, maxParallelism).setConfiguration(configuration).setSubtaskIndex(split.getSplitNumber()).setPrioritizedOperatorSubtaskState(split.getPrioritizedOperatorSubtaskState()).build();
StateBackend stateBackend;
try {
stateBackend = StateBackendLoader.fromApplicationOrConfigOrDefault(applicationStateBackend, TernaryBoolean.FALSE, configuration, ctx.getUserCodeClassLoader(), logger);
} catch (DynamicCodeLoadingException e) {
throw new IOException("Failed to load state backend", e);
}
StreamTaskStateInitializer initializer = new StreamTaskStateInitializerImpl(environment, stateBackend);
try {
return initializer.streamOperatorStateContext(operatorState.getOperatorID(), operatorState.getOperatorID().toString(), new NeverFireProcessingTimeService(), keyContext, keySerializer, registry, ctx.getMetricGroup(), 1.0, false);
} catch (Exception e) {
throw new IOException("Failed to restore state backend", e);
}
}
Aggregations