Fix and improve EngineRunning state by andimarek · Pull Request #3911 · graphql-java/graphql-java · GitHub
Skip to content
Merged
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
27 changes: 18 additions & 9 deletions src/main/java/graphql/EngineRunningState.java
2 changes: 1 addition & 1 deletion src/main/java/graphql/GraphQL.java
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ public CompletableFuture<ExecutionResult> executeAsync(UnaryOperator<ExecutionIn
*/
public CompletableFuture<ExecutionResult> executeAsync(ExecutionInput executionInput) {
EngineRunningState engineRunningState = new EngineRunningState(executionInput);
return engineRunningState.call(() -> {
return engineRunningState.engineRun(() -> {
ExecutionInput executionInputWithId = ensureInputHasId(executionInput);
engineRunningState.updateExecutionId(executionInputWithId.getExecutionId());

Expand Down
8 changes: 8 additions & 0 deletions src/main/java/graphql/execution/EngineRunningObserver.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
public interface EngineRunningObserver {

enum RunningState {
/**
* Represents that the engine is running, for the first time
*/
RUNNING_START,
/**
* Represents that the engine code is actively running its own code
*/
Expand All @@ -22,6 +26,10 @@ enum RunningState {
* Represents that the engine code is asynchronously waiting for fetching to happen
*/
NOT_RUNNING,
/**
* Represents that the engine is finished
*/
NOT_RUNNING_FINISH
}


Expand Down
40 changes: 20 additions & 20 deletions src/test/groovy/graphql/EngineRunningTest.groovy
Loading