1919import graphql .execution .instrumentation .InstrumentationState ;
2020import graphql .execution .instrumentation .NoContextChainedInstrumentation ;
2121import graphql .execution .instrumentation .SimplePerformantInstrumentation ;
22- import graphql .execution .instrumentation .dataloader .DataLoaderDispatcherInstrumentation ;
2322import graphql .execution .instrumentation .parameters .InstrumentationCreateStateParameters ;
2423import graphql .execution .instrumentation .parameters .InstrumentationExecutionParameters ;
2524import graphql .execution .instrumentation .parameters .InstrumentationValidationParameters ;
@@ -169,7 +168,6 @@ public ValueUnboxer getValueUnboxer() {
169168 * Helps you build a GraphQL object ready to execute queries
170169 *
171170 * @param graphQLSchema the schema to use
172- *
173171 * @return a builder of GraphQL objects
174172 */
175173 public static Builder newGraphQL (GraphQLSchema graphQLSchema ) {
@@ -181,18 +179,17 @@ public static Builder newGraphQL(GraphQLSchema graphQLSchema) {
181179 * the current values and allows you to transform it how you want.
182180 *
183181 * @param builderConsumer the consumer code that will be given a builder to transform
184- *
185182 * @return a new GraphQL object based on calling build on that builder
186183 */
187184 public GraphQL transform (Consumer <GraphQL .Builder > builderConsumer ) {
188185 Builder builder = new Builder (this .graphQLSchema );
189186 builder
190- .queryExecutionStrategy (this .queryStrategy )
191- .mutationExecutionStrategy (this .mutationStrategy )
192- .subscriptionExecutionStrategy (this .subscriptionStrategy )
193- .executionIdProvider (Optional .ofNullable (this .idProvider ).orElse (builder .idProvider ))
194- .instrumentation (Optional .ofNullable (this .instrumentation ).orElse (builder .instrumentation ))
195- .preparsedDocumentProvider (Optional .ofNullable (this .preparsedDocumentProvider ).orElse (builder .preparsedDocumentProvider ));
187+ .queryExecutionStrategy (this .queryStrategy )
188+ .mutationExecutionStrategy (this .mutationStrategy )
189+ .subscriptionExecutionStrategy (this .subscriptionStrategy )
190+ .executionIdProvider (Optional .ofNullable (this .idProvider ).orElse (builder .idProvider ))
191+ .instrumentation (Optional .ofNullable (this .instrumentation ).orElse (builder .instrumentation ))
192+ .preparsedDocumentProvider (Optional .ofNullable (this .preparsedDocumentProvider ).orElse (builder .preparsedDocumentProvider ));
196193
197194 builderConsumer .accept (builder );
198195
@@ -242,7 +239,6 @@ public Builder subscriptionExecutionStrategy(ExecutionStrategy executionStrategy
242239 * in {@link graphql.schema.DataFetcher} invocations.
243240 *
244241 * @param dataFetcherExceptionHandler the default handler for data fetching exception
245- *
246242 * @return this builder
247243 */
248244 public Builder defaultDataFetcherExceptionHandler (DataFetcherExceptionHandler dataFetcherExceptionHandler ) {
@@ -308,13 +304,12 @@ public GraphQL build() {
308304 * Executes the specified graphql query/mutation/subscription
309305 *
310306 * @param query the query/mutation/subscription
311- *
312307 * @return an {@link ExecutionResult} which can include errors
313308 */
314309 public ExecutionResult execute (String query ) {
315310 ExecutionInput executionInput = ExecutionInput .newExecutionInput ()
316- .query (query )
317- .build ();
311+ .query (query )
312+ .build ();
318313 return execute (executionInput );
319314 }
320315
@@ -323,7 +318,6 @@ public ExecutionResult execute(String query) {
323318 * Executes the graphql query using the provided input object builder
324319 *
325320 * @param executionInputBuilder {@link ExecutionInput.Builder}
326- *
327321 * @return an {@link ExecutionResult} which can include errors
328322 */
329323 public ExecutionResult execute (ExecutionInput .Builder executionInputBuilder ) {
@@ -341,7 +335,6 @@ public ExecutionResult execute(ExecutionInput.Builder executionInputBuilder) {
341335 * </pre>
342336 *
343337 * @param builderFunction a function that is given a {@link ExecutionInput.Builder}
344- *
345338 * @return an {@link ExecutionResult} which can include errors
346339 */
347340 public ExecutionResult execute (UnaryOperator <ExecutionInput .Builder > builderFunction ) {
@@ -352,7 +345,6 @@ public ExecutionResult execute(UnaryOperator<ExecutionInput.Builder> builderFunc
352345 * Executes the graphql query using the provided input object
353346 *
354347 * @param executionInput {@link ExecutionInput}
355- *
356348 * @return an {@link ExecutionResult} which can include errors
357349 */
358350 public ExecutionResult execute (ExecutionInput executionInput ) {
@@ -374,7 +366,6 @@ public ExecutionResult execute(ExecutionInput executionInput) {
374366 * which is the result of executing the provided query.
375367 *
376368 * @param executionInputBuilder {@link ExecutionInput.Builder}
377- *
378369 * @return a promise to an {@link ExecutionResult} which can include errors
379370 */
380371 public CompletableFuture <ExecutionResult > executeAsync (ExecutionInput .Builder executionInputBuilder ) {
@@ -395,7 +386,6 @@ public CompletableFuture<ExecutionResult> executeAsync(ExecutionInput.Builder ex
395386 * </pre>
396387 *
397388 * @param builderFunction a function that is given a {@link ExecutionInput.Builder}
398- *
399389 * @return a promise to an {@link ExecutionResult} which can include errors
400390 */
401391 public CompletableFuture <ExecutionResult > executeAsync (UnaryOperator <ExecutionInput .Builder > builderFunction ) {
@@ -409,7 +399,6 @@ public CompletableFuture<ExecutionResult> executeAsync(UnaryOperator<ExecutionIn
409399 * which is the result of executing the provided query.
410400 *
411401 * @param executionInput {@link ExecutionInput}
412- *
413402 * @return a promise to an {@link ExecutionResult} which can include errors
414403 */
415404 public CompletableFuture <ExecutionResult > executeAsync (ExecutionInput executionInput ) {
@@ -522,7 +511,7 @@ private ParseAndValidateResult parse(ExecutionInput executionInput, GraphQLSchem
522511 DocumentAndVariables documentAndVariables = parseResult .getDocumentAndVariables ();
523512 documentAndVariables = instrumentation .instrumentDocumentAndVariables (documentAndVariables , parameters , instrumentationState );
524513 return ParseAndValidateResult .newResult ()
525- .document (documentAndVariables .getDocument ()).variables (documentAndVariables .getVariables ()).build ();
514+ .document (documentAndVariables .getDocument ()).variables (documentAndVariables .getVariables ()).build ();
526515 }
527516 }
528517
@@ -552,14 +541,15 @@ private static Instrumentation checkInstrumentationDefaultState(Instrumentation
552541 if (doNotAddDefaultInstrumentations ) {
553542 return instrumentation == null ? SimplePerformantInstrumentation .INSTANCE : instrumentation ;
554543 }
555- if (instrumentation instanceof DataLoaderDispatcherInstrumentation ) {
556- return instrumentation ;
557- }
544+ // if (instrumentation instanceof DataLoaderDispatcherInstrumentation) {
545+ // return instrumentation;
546+ // }
558547 if (instrumentation instanceof NoContextChainedInstrumentation ) {
559548 return instrumentation ;
560549 }
561550 if (instrumentation == null ) {
562- return new DataLoaderDispatcherInstrumentation ();
551+ // return new DataLoaderDispatcherInstrumentation();
552+ return SimplePerformantInstrumentation .INSTANCE ;
563553 }
564554
565555 //
@@ -572,10 +562,10 @@ private static Instrumentation checkInstrumentationDefaultState(Instrumentation
572562 } else {
573563 instrumentationList .add (instrumentation );
574564 }
575- boolean containsDLInstrumentation = instrumentationList .stream ().anyMatch (instr -> instr instanceof DataLoaderDispatcherInstrumentation );
576- if (!containsDLInstrumentation ) {
577- instrumentationList .add (new DataLoaderDispatcherInstrumentation ());
578- }
565+ // boolean containsDLInstrumentation = instrumentationList.stream().anyMatch(instr -> instr instanceof DataLoaderDispatcherInstrumentation);
566+ // if (!containsDLInstrumentation) {
567+ // instrumentationList.add(new DataLoaderDispatcherInstrumentation());
568+ // }
579569 return new ChainedInstrumentation (instrumentationList );
580570 }
581571}
0 commit comments