Skip to content

Commit 0b1f0f4

Browse files
committed
fix(#469): use separate async enabled property
1 parent 3fe62ab commit 0b1f0f4

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version=14.0.0-SNAPSHOT
1+
version=13.0.1-SNAPSHOT
22
group=com.graphql-java-kickstart
33
PROJECT_NAME=graphql-java-servlet
44
PROJECT_DESC=GraphQL Java Kickstart

graphql-java-servlet/src/main/java/graphql/kickstart/servlet/GraphQLConfiguration.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public class GraphQLConfiguration {
3232
private final GraphQLObjectMapper objectMapper;
3333
private final List<GraphQLServletListener> listeners;
3434
private final long subscriptionTimeout;
35+
@Getter private final boolean asyncEnabled;
3536
@Getter private final long asyncTimeout;
3637
private final ContextSetting contextSetting;
3738
private final GraphQLResponseCacheManager responseCacheManager;
@@ -45,6 +46,7 @@ private GraphQLConfiguration(
4546
GraphQLObjectMapper objectMapper,
4647
List<GraphQLServletListener> listeners,
4748
long subscriptionTimeout,
49+
boolean asyncEnabled,
4850
long asyncTimeout,
4951
ContextSetting contextSetting,
5052
Supplier<BatchInputPreProcessor> batchInputPreProcessor,
@@ -56,6 +58,7 @@ private GraphQLConfiguration(
5658
this.objectMapper = objectMapper;
5759
this.listeners = listeners;
5860
this.subscriptionTimeout = subscriptionTimeout;
61+
this.asyncEnabled = asyncEnabled;
5962
this.asyncTimeout = asyncTimeout;
6063
this.contextSetting = contextSetting;
6164
this.batchInputPreProcessor = batchInputPreProcessor;
@@ -139,6 +142,7 @@ public static class Builder {
139142
private GraphQLObjectMapper objectMapper = GraphQLObjectMapper.newBuilder().build();
140143
private List<GraphQLServletListener> listeners = new ArrayList<>();
141144
private long subscriptionTimeout = 0;
145+
private boolean asyncEnabled = false;
142146
private long asyncTimeout = 30000;
143147
private ContextSetting contextSetting = ContextSetting.PER_QUERY_WITH_INSTRUMENTATION;
144148
private Supplier<BatchInputPreProcessor> batchInputPreProcessorSupplier =
@@ -208,6 +212,11 @@ public Builder with(Executor asyncExecutor) {
208212
return this;
209213
}
210214

215+
public Builder asyncEnabled(boolean enabled) {
216+
this.asyncEnabled = enabled;
217+
return this;
218+
}
219+
211220
public Builder asyncCorePoolSize(int asyncCorePoolSize) {
212221
this.asyncCorePoolSize = asyncCorePoolSize;
213222
return this;
@@ -275,6 +284,7 @@ public GraphQLConfiguration build() {
275284
objectMapper,
276285
listeners,
277286
subscriptionTimeout,
287+
asyncEnabled,
278288
asyncTimeout,
279289
contextSetting,
280290
batchInputPreProcessorSupplier,

graphql-java-servlet/src/main/java/graphql/kickstart/servlet/HttpRequestInvokerImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public void execute(
4141
HttpServletRequest request,
4242
HttpServletResponse response,
4343
ListenerHandler listenerHandler) {
44-
if (request.isAsyncSupported()) {
44+
if (configuration.isAsyncEnabled()) {
4545
invokeAndHandleAsync(invocationInput, request, response, listenerHandler);
4646
} else {
4747
handle(invocationInput, request, response, listenerHandler);

0 commit comments

Comments
 (0)