Skip to content

Commit b66eade

Browse files
authored
Deprecate ExecutorServiceExecutionStrategy (graphql-java#1175)
* Added @OverRide as part of errorprone code health check * Revert "Added @OverRide as part of errorprone code health check" This reverts commit 38dfab1 * Deprecated ESES
1 parent 00a720f commit b66eade

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/main/java/graphql/execution/ExecutorServiceExecutionStrategy.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@
2020
import java.util.concurrent.Future;
2121

2222
/**
23+
*
24+
* <p>Deprecation Notice : This execution strategy does not support all of the graphql-java capabilities
25+
* such as data loader or @defer fields. Since its so easy to create a data fetcher that uses
26+
* {@link java.util.concurrent.CompletableFuture#supplyAsync(java.util.function.Supplier, java.util.concurrent.Executor)}
27+
* to make field fetching happen off thread we recommend that you use that instead of this class. This class
28+
* will be removed in a future version.
29+
* </p>
30+
*
2331
* <p>ExecutorServiceExecutionStrategy uses an {@link ExecutorService} to parallelize the resolve.</p>
2432
*
2533
* Due to the nature of {@link #execute(ExecutionContext, ExecutionStrategyParameters)} implementation, {@link ExecutorService}
@@ -32,8 +40,12 @@
3240
* <p>Failure to follow 1. and 2. can result in a very large number of threads created or hanging. (deadlock)</p>
3341
*
3442
* See {@code graphql.execution.ExecutorServiceExecutionStrategyTest} for example usage.
43+
*
44+
* @deprecated Use {@link graphql.execution.AsyncExecutionStrategy} and {@link java.util.concurrent.CompletableFuture#supplyAsync(java.util.function.Supplier, java.util.concurrent.Executor)}
45+
* in your data fetchers instead.
3546
*/
3647
@PublicApi
48+
@Deprecated
3749
public class ExecutorServiceExecutionStrategy extends ExecutionStrategy {
3850

3951
final ExecutorService executorService;

src/test/groovy/graphql/execution/ExecutorServiceExecutionStrategyTest.groovy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import java.util.concurrent.LinkedBlockingQueue
99
import java.util.concurrent.ThreadPoolExecutor
1010
import java.util.concurrent.TimeUnit
1111

12+
@Deprecated
1213
class ExecutorServiceExecutionStrategyTest extends Specification {
1314

1415
def 'Example usage of ExecutorServiceExecutionStrategy.'() {

0 commit comments

Comments
 (0)