graphql.execution.AsyncSerialExecutionStrategy Maven / Gradle / Ivy
package graphql.execution;
import graphql.ExecutionResult;
import graphql.execution.instrumentation.Instrumentation;
import graphql.execution.instrumentation.InstrumentationContext;
import graphql.execution.instrumentation.parameters.InstrumentationExecutionStrategyParameters;
import graphql.language.Field;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.function.BiConsumer;
/**
* Async non-blocking execution, but serial: only one field at the the time will be resolved.
* See {@link AsyncExecutionStrategy} for a non serial (parallel) execution of every field.
*/
public class AsyncSerialExecutionStrategy extends AbstractAsyncExecutionStrategy {
public AsyncSerialExecutionStrategy() {
super(new SimpleDataFetcherExceptionHandler());
}
public AsyncSerialExecutionStrategy(DataFetcherExceptionHandler exceptionHandler) {
super(exceptionHandler);
}
@Override
public CompletableFuture execute(ExecutionContext executionContext, ExecutionStrategyParameters parameters) throws NonNullableFieldWasNullException {
Instrumentation instrumentation = executionContext.getInstrumentation();
InstrumentationExecutionStrategyParameters instrumentationParameters = new InstrumentationExecutionStrategyParameters(executionContext);
InstrumentationContext> executionStrategyCtx = instrumentation.beginExecutionStrategy(instrumentationParameters);
Map> fields = parameters.fields();
List fieldNames = new ArrayList<>(fields.keySet());
InstrumentationContext
© 2015 - 2025 Weber Informatics LLC | Privacy Policy