public class ExecutorServiceExecutionStrategy extends ExecutionStrategy
ExecutorService
to parallelize the resolve.
Due to the nature of execute(ExecutionContext, GraphQLObjectType, Object, Map)
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) See
graphql.execution.ExecutorServiceExecutionStrategyTest
for example usage.fieldCollector, valuesResolver
Constructor and Description |
---|
ExecutorServiceExecutionStrategy(java.util.concurrent.ExecutorService executorService) |
Modifier and Type | Method and Description |
---|---|
ExecutionResult |
execute(ExecutionContext executionContext,
GraphQLObjectType parentType,
java.lang.Object source,
java.util.Map<java.lang.String,java.util.List<Field>> fields) |
completeValue, completeValueForEnum, completeValueForList, completeValueForScalar, getFieldDef, resolveField, resolveType, resolveType
public ExecutorServiceExecutionStrategy(java.util.concurrent.ExecutorService executorService)
public ExecutionResult execute(ExecutionContext executionContext, GraphQLObjectType parentType, java.lang.Object source, java.util.Map<java.lang.String,java.util.List<Field>> fields)
execute
in class ExecutionStrategy