AsyncExecutionStrategy and CompletableFuture.supplyAsync(java.util.function.Supplier, java.util.concurrent.Executor)
in your data fetchers instead.@PublicApi @Deprecated public class ExecutorServiceExecutionStrategy extends ExecutionStrategy
Deprecation Notice : This execution strategy does not support all of the graphql-java capabilities
such as data loader. Since its so easy to create a data fetcher that uses
CompletableFuture.supplyAsync(java.util.function.Supplier, java.util.concurrent.Executor)
to make field fetching happen off thread we recommend that you use that instead of this class. This class
will be removed in a future version.
ExecutorServiceExecutionStrategy uses an ExecutorService to parallelize the resolve.
execute(ExecutionContext, ExecutionStrategyParameters) implementation, ExecutorService
MUST have the following 2 characteristics:
ThreadPoolExecutor MUST have a reasonable maximumPoolSize
ThreadPoolExecutor SHALL NOT use its task queue.
Failure to follow 1. and 2. can result in a very large number of threads created or hanging. (deadlock)
Seegraphql.execution.ExecutorServiceExecutionStrategyTest for example usage.dataFetcherExceptionHandler, executionStepInfoFactory, fieldCollector, valuesResolver| Constructor and Description |
|---|
ExecutorServiceExecutionStrategy(java.util.concurrent.ExecutorService executorService)
Deprecated.
|
ExecutorServiceExecutionStrategy(java.util.concurrent.ExecutorService executorService,
DataFetcherExceptionHandler dataFetcherExceptionHandler)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
java.util.concurrent.CompletableFuture<ExecutionResult> |
execute(ExecutionContext executionContext,
ExecutionStrategyParameters parameters)
Deprecated.
This is the entry point to an execution strategy.
|
assertNonNullFieldPrecondition, assertNonNullFieldPrecondition, completeField, completeValue, completeValueForEnum, completeValueForList, completeValueForList, completeValueForObject, completeValueForScalar, createExecutionStepInfo, fetchField, getFieldDef, getFieldDef, getNormalizedField, handleFetchingException, handleNonNullException, mkNameForPath, mkNameForPath, mkNameForPath, resolveField, resolveFieldWithInfo, resolveType, toIterable, toIterable, unboxPossibleDataFetcherResultpublic ExecutorServiceExecutionStrategy(java.util.concurrent.ExecutorService executorService)
public ExecutorServiceExecutionStrategy(java.util.concurrent.ExecutorService executorService,
DataFetcherExceptionHandler dataFetcherExceptionHandler)
public java.util.concurrent.CompletableFuture<ExecutionResult> execute(ExecutionContext executionContext, ExecutionStrategyParameters parameters)
ExecutionStrategyexecute in class ExecutionStrategyexecutionContext - contains the top level execution parametersparameters - contains the parameters holding the fields to be executed and source objectExecutionResult