|
3 | 3 | import graphql.ExecutionResult; |
4 | 4 | import graphql.execution.instrumentation.parameters.InstrumentationDataFetchParameters; |
5 | 5 | import graphql.execution.instrumentation.parameters.InstrumentationExecutionParameters; |
| 6 | +import graphql.execution.instrumentation.parameters.InstrumentationExecutionStrategyParameters; |
6 | 7 | import graphql.execution.instrumentation.parameters.InstrumentationFieldFetchParameters; |
7 | 8 | import graphql.execution.instrumentation.parameters.InstrumentationFieldParameters; |
8 | 9 | import graphql.execution.instrumentation.parameters.InstrumentationValidationParameters; |
@@ -74,6 +75,23 @@ default InstrumentationState createState() { |
74 | 75 | */ |
75 | 76 | InstrumentationContext<ExecutionResult> beginDataFetch(InstrumentationDataFetchParameters parameters); |
76 | 77 |
|
| 78 | + /** |
| 79 | + * This is called each time the {@link graphql.execution.ExecutionStrategy} is invoked and when the |
| 80 | + * {@link java.util.concurrent.CompletableFuture} has been dispatched for the query fields the |
| 81 | + * {@link graphql.execution.instrumentation.InstrumentationContext#onEnd(Object, Throwable)} |
| 82 | + * is called. |
| 83 | + * |
| 84 | + * Note because the execution strategy execution is asynchronous, the query data is not guaranteed to be |
| 85 | + * completed when this step finishes. It is however a chance to dispatch side effects that might cause |
| 86 | + * asynchronous data fetching code to actually run or attach CompletableFuture handlers onto the result |
| 87 | + * via Instrumentation. |
| 88 | + * |
| 89 | + * @param parameters the parameters to this step |
| 90 | + * |
| 91 | + * @return a non null {@link InstrumentationContext} object that will be called back when the step ends |
| 92 | + */ |
| 93 | + InstrumentationContext<CompletableFuture<ExecutionResult>> beginExecutionStrategy(InstrumentationExecutionStrategyParameters parameters); |
| 94 | + |
77 | 95 | /** |
78 | 96 | * This is called just before a field is resolved and when this step finishes the {@link InstrumentationContext#onEnd(Object, Throwable)} |
79 | 97 | * will be called indicating that the step has finished. |
@@ -113,7 +131,7 @@ default DataFetcher<?> instrumentDataFetcher(DataFetcher<?> dataFetcher, Instrum |
113 | 131 | * This is called to allow instrumentation to instrument the execution result in some way |
114 | 132 | * |
115 | 133 | * @param executionResult {@link java.util.concurrent.CompletableFuture} of the result to instrument |
116 | | - * @param parameters the parameters to this step |
| 134 | + * @param parameters the parameters to this step |
117 | 135 | * |
118 | 136 | * @return a new execution result completable future |
119 | 137 | */ |
|
0 commit comments