Skip to content

Commit 4008c11

Browse files
committed
master merging
1 parent 2ba4123 commit 4008c11

File tree

8 files changed

+15
-35
lines changed

8 files changed

+15
-35
lines changed

src/main/java/graphql/EngineRunningState.java

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -36,32 +36,14 @@ public class EngineRunningState {
3636

3737
private final AtomicInteger isRunning = new AtomicInteger(0);
3838

39-
@VisibleForTesting
40-
public EngineRunningState() {
41-
this.engineRunningObserver = null;
42-
this.graphQLContext = null;
43-
this.executionId = null;
44-
}
45-
46-
public EngineRunningState(ExecutionInput executionInput) {
47-
this.executionInput = executionInput;
48-
this.graphQLContext = executionInput.getGraphQLContext();
49-
this.executionId = executionInput.getExecutionId();
50-
this.engineRunningObserver = executionInput.getGraphQLContext().get(EngineRunningObserver.ENGINE_RUNNING_OBSERVER_KEY);
51-
}
5239

5340
public EngineRunningState(ExecutionInput executionInput, Profiler profiler) {
5441
EngineRunningObserver engineRunningObserver = executionInput.getGraphQLContext().get(EngineRunningObserver.ENGINE_RUNNING_OBSERVER_KEY);
5542
EngineRunningObserver wrappedObserver = profiler.wrapEngineRunningObserver(engineRunningObserver);
56-
if (wrappedObserver != null) {
57-
this.engineRunningObserver = wrappedObserver;
58-
this.graphQLContext = executionInput.getGraphQLContext();
59-
this.executionId = executionInput.getExecutionId();
60-
} else {
61-
this.engineRunningObserver = null;
62-
this.graphQLContext = null;
63-
this.executionId = null;
64-
}
43+
this.engineRunningObserver = wrappedObserver;
44+
this.executionInput = executionInput;
45+
this.graphQLContext = executionInput.getGraphQLContext();
46+
this.executionId = executionInput.getExecutionId();
6547
}
6648

6749

src/main/java/graphql/Profiler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ default void fieldFetched(Object fetchedObject, DataFetcher<?> dataFetcher, Resu
3030

3131
}
3232

33-
default @Nullable EngineRunningObserver wrapEngineRunningObserver(EngineRunningObserver engineRunningObserver) {
33+
default @Nullable EngineRunningObserver wrapEngineRunningObserver(@Nullable EngineRunningObserver engineRunningObserver) {
3434
return engineRunningObserver;
3535
}
3636

src/main/java/graphql/ProfilerImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public void fieldFetched(Object fetchedObject, DataFetcher<?> dataFetcher, Resul
6666
}
6767

6868
@Override
69-
public EngineRunningObserver wrapEngineRunningObserver(EngineRunningObserver engineRunningObserver) {
69+
public EngineRunningObserver wrapEngineRunningObserver(@Nullable EngineRunningObserver engineRunningObserver) {
7070
// nothing to wrap here
7171
return new EngineRunningObserver() {
7272
@Override

src/main/java/graphql/execution/ExecutionContext.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,6 @@ Throwable possibleCancellation(@Nullable Throwable currentThrowable) {
391391
public Profiler getProfiler() {
392392
return profiler;
393393
}
394-
}
395394

396395
@Internal
397396
void throwIfCancelled() throws AbortExecutionException {

src/test/groovy/graphql/execution/AsyncExecutionStrategyTest.groovy

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ abstract class AsyncExecutionStrategyTest extends Specification {
114114
.executionInput(ei)
115115
.locale(Locale.getDefault())
116116
.profiler(Profiler.NO_OP)
117-
.engineRunningState(new EngineRunningState(ei))
117+
.engineRunningState(new EngineRunningState(ei, Profiler.NO_OP))
118118
.build()
119119
ExecutionStrategyParameters executionStrategyParameters = ExecutionStrategyParameters
120120
.newParameters()
@@ -159,7 +159,7 @@ abstract class AsyncExecutionStrategyTest extends Specification {
159159
.locale(Locale.getDefault())
160160
.graphQLContext(graphqlContextMock)
161161
.executionInput(ei)
162-
.engineRunningState(new EngineRunningState(ei))
162+
.engineRunningState(new EngineRunningState(ei, Profiler.NO_OP))
163163
.profiler(Profiler.NO_OP)
164164
.build()
165165
ExecutionStrategyParameters executionStrategyParameters = ExecutionStrategyParameters
@@ -206,7 +206,7 @@ abstract class AsyncExecutionStrategyTest extends Specification {
206206
.instrumentation(SimplePerformantInstrumentation.INSTANCE)
207207
.graphQLContext(graphqlContextMock)
208208
.executionInput(ei)
209-
.engineRunningState(new EngineRunningState(ei))
209+
.engineRunningState(new EngineRunningState(ei, Profiler.NO_OP))
210210
.locale(Locale.getDefault())
211211
.profiler(Profiler.NO_OP)
212212
.build()
@@ -254,7 +254,7 @@ abstract class AsyncExecutionStrategyTest extends Specification {
254254
.locale(Locale.getDefault())
255255
.graphQLContext(graphqlContextMock)
256256
.executionInput(ei)
257-
.engineRunningState(new EngineRunningState(ei))
257+
.engineRunningState(new EngineRunningState(ei, Profiler.NO_OP))
258258
.profiler(Profiler.NO_OP)
259259
.build()
260260
ExecutionStrategyParameters executionStrategyParameters = ExecutionStrategyParameters
@@ -299,7 +299,7 @@ abstract class AsyncExecutionStrategyTest extends Specification {
299299
.graphQLContext(graphqlContextMock)
300300
.executionInput(ei)
301301
.locale(Locale.getDefault())
302-
.engineRunningState(new EngineRunningState(ei))
302+
.engineRunningState(new EngineRunningState(ei, Profiler.NO_OP))
303303
.profiler(Profiler.NO_OP)
304304
.instrumentation(new SimplePerformantInstrumentation() {
305305

src/test/groovy/graphql/execution/AsyncSerialExecutionStrategyTest.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ class AsyncSerialExecutionStrategyTest extends Specification {
113113
.executionInput(ExecutionInput.newExecutionInput("{}").build())
114114
.profiler(Profiler.NO_OP)
115115
.executionInput(ei)
116-
.engineRunningState(new EngineRunningState(ei))
116+
.engineRunningState(new EngineRunningState(ei, Profiler.NO_OP))
117117
.build()
118118
ExecutionStrategyParameters executionStrategyParameters = ExecutionStrategyParameters
119119
.newParameters()
@@ -163,7 +163,7 @@ class AsyncSerialExecutionStrategyTest extends Specification {
163163
.locale(Locale.getDefault())
164164
.graphQLContext(GraphQLContext.getDefault())
165165
.executionInput(ei)
166-
.engineRunningState(new EngineRunningState(ei))
166+
.engineRunningState(new EngineRunningState(ei, Profiler.NO_OP))
167167
.executionInput(ExecutionInput.newExecutionInput("{}").build())
168168
.profiler(Profiler.NO_OP)
169169
.build()

src/test/groovy/graphql/execution/ExecutionStrategyTest.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class ExecutionStrategyTest extends Specification {
8888
.locale(Locale.getDefault())
8989
.valueUnboxer(ValueUnboxer.DEFAULT)
9090
.profiler(Profiler.NO_OP)
91-
.engineRunningState(new EngineRunningState(ei))
91+
.engineRunningState(new EngineRunningState(ei, Profiler.NO_OP))
9292

9393
new ExecutionContext(builder)
9494
}

src/test/groovy/graphql/execution/instrumentation/fieldvalidation/FieldValidationTest.groovy

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import graphql.execution.AbortExecutionException
1111
import graphql.execution.AsyncExecutionStrategy
1212
import graphql.execution.Execution
1313
import graphql.execution.ExecutionId
14-
import graphql.execution.ResponseMapFactory
1514
import graphql.execution.ResultPath
1615
import graphql.execution.ValueUnboxer
1716
import graphql.execution.instrumentation.ChainedInstrumentation
@@ -311,7 +310,7 @@ class FieldValidationTest extends Specification {
311310
def execution = new Execution(strategy, strategy, strategy, instrumentation, ValueUnboxer.DEFAULT, false)
312311

313312
def executionInput = ExecutionInput.newExecutionInput().query(query).variables(variables).build()
314-
execution.execute(document, schema, ExecutionId.generate(), executionInput, null, new EngineRunningState(executionInput), Profiler.NO_OP)
313+
execution.execute(document, schema, ExecutionId.generate(), executionInput, null, new EngineRunningState(executionInput, Profiler.NO_OP), Profiler.NO_OP)
315314
}
316315

317316
def "test graphql from end to end with chained instrumentation"() {

0 commit comments

Comments
 (0)