20
20
import java .util .concurrent .Executor ;
21
21
import java .util .concurrent .Executors ;
22
22
import java .util .function .Supplier ;
23
+ import lombok .Getter ;
23
24
24
25
public class GraphQLConfiguration {
25
26
@@ -32,12 +33,14 @@ public class GraphQLConfiguration {
32
33
private final boolean asyncServletModeEnabled ;
33
34
private final Executor asyncExecutor ;
34
35
private final long subscriptionTimeout ;
36
+ @ Getter
37
+ private final long asyncTimeout ;
35
38
private final ContextSetting contextSetting ;
36
39
37
40
private GraphQLConfiguration (GraphQLInvocationInputFactory invocationInputFactory ,
38
41
GraphQLQueryInvoker queryInvoker ,
39
42
GraphQLObjectMapper objectMapper , List <GraphQLServletListener > listeners , boolean asyncServletModeEnabled ,
40
- Executor asyncExecutor , long subscriptionTimeout , ContextSetting contextSetting ,
43
+ Executor asyncExecutor , long subscriptionTimeout , long asyncTimeout , ContextSetting contextSetting ,
41
44
Supplier <BatchInputPreProcessor > batchInputPreProcessor ) {
42
45
this .invocationInputFactory = invocationInputFactory ;
43
46
this .queryInvoker = queryInvoker ;
@@ -47,6 +50,7 @@ private GraphQLConfiguration(GraphQLInvocationInputFactory invocationInputFactor
47
50
this .asyncServletModeEnabled = asyncServletModeEnabled ;
48
51
this .asyncExecutor = asyncExecutor ;
49
52
this .subscriptionTimeout = subscriptionTimeout ;
53
+ this .asyncTimeout = asyncTimeout ;
50
54
this .contextSetting = contextSetting ;
51
55
this .batchInputPreProcessor = batchInputPreProcessor ;
52
56
}
@@ -119,8 +123,9 @@ public static class Builder {
119
123
private boolean asyncServletModeEnabled = false ;
120
124
private Executor asyncExecutor = Executors .newCachedThreadPool (new GraphQLThreadFactory ());
121
125
private long subscriptionTimeout = 0 ;
126
+ private long asyncTimeout = 30 ;
122
127
private ContextSetting contextSetting = ContextSetting .PER_QUERY_WITH_INSTRUMENTATION ;
123
- private Supplier <BatchInputPreProcessor > batchInputPreProcessorSupplier = () -> new NoOpBatchInputPreProcessor () ;
128
+ private Supplier <BatchInputPreProcessor > batchInputPreProcessorSupplier = NoOpBatchInputPreProcessor :: new ;
124
129
125
130
private Builder (GraphQLInvocationInputFactory .Builder invocationInputFactoryBuilder ) {
126
131
this .invocationInputFactoryBuilder = invocationInputFactoryBuilder ;
@@ -178,6 +183,11 @@ public Builder with(long subscriptionTimeout) {
178
183
return this ;
179
184
}
180
185
186
+ public Builder asyncTimeout (long asyncTimeout ) {
187
+ this .asyncTimeout = asyncTimeout ;
188
+ return this ;
189
+ }
190
+
181
191
public Builder with (ContextSetting contextSetting ) {
182
192
if (contextSetting != null ) {
183
193
this .contextSetting = contextSetting ;
@@ -208,6 +218,7 @@ public GraphQLConfiguration build() {
208
218
asyncServletModeEnabled ,
209
219
asyncExecutor ,
210
220
subscriptionTimeout ,
221
+ asyncTimeout ,
211
222
contextSetting ,
212
223
batchInputPreProcessorSupplier
213
224
);
0 commit comments