Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/main/java/graphql/execution/Execution.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@ private ExecutionResult executeOperation(ExecutionContext executionContext, Obje
ExecutionResult result;
try {
if (operation == OperationDefinition.Operation.MUTATION) {
result = mutationStrategy.execute(executionContext, parameters);
result = mutationStrategy.execute(executionContext, parameters).toCompletableFuture().join();
} else if (operation == SUBSCRIPTION) {
result = subscriptionStrategy.execute(executionContext, parameters);
result = subscriptionStrategy.execute(executionContext, parameters).toCompletableFuture().join();
} else {
result = queryStrategy.execute(executionContext, parameters);
result = queryStrategy.execute(executionContext, parameters).toCompletableFuture().join();
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One decision we need to make is whether to use CompletionStage or CompletableFuture (or a mix of both)

Standard Java best practice says use the interface CompletionStage. Except you can never get the value of a CompletionStage and so you have all these .toCompleteableFuture() calls

Since this code base is all about materialising values (eventually) perhaps we should use CompletableFuture?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps they will evolve the CompletionStage interface to make it useful. toCompletableFuture().get() is not horrible imo.

} catch (NonNullableFieldWasNullException e) {
// this means it was non null types all the way from an offending non null type
Expand Down
Loading