-
Notifications
You must be signed in to change notification settings - Fork 645
/
ApolloClient.java
600 lines (525 loc) · 22.7 KB
/
ApolloClient.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
package com.apollographql.apollo3.runtime.java;
import com.apollographql.apollo3.annotations.ApolloExperimental;
import com.apollographql.apollo3.api.Adapter;
import com.apollographql.apollo3.api.ApolloRequest;
import com.apollographql.apollo3.api.CustomScalarAdapters;
import com.apollographql.apollo3.api.CustomScalarType;
import com.apollographql.apollo3.api.ExecutionContext;
import com.apollographql.apollo3.api.ExecutionOptions;
import com.apollographql.apollo3.api.MutableExecutionOptions;
import com.apollographql.apollo3.api.Mutation;
import com.apollographql.apollo3.api.Operation;
import com.apollographql.apollo3.api.Query;
import com.apollographql.apollo3.api.ScalarType;
import com.apollographql.apollo3.api.Subscription;
import com.apollographql.apollo3.api.http.DefaultHttpRequestComposer;
import com.apollographql.apollo3.api.http.HttpHeader;
import com.apollographql.apollo3.api.http.HttpMethod;
import com.apollographql.apollo3.runtime.java.interceptor.ApolloInterceptor;
import com.apollographql.apollo3.runtime.java.interceptor.ApolloInterceptorChain;
import com.apollographql.apollo3.runtime.java.interceptor.internal.AutoPersistedQueryInterceptor;
import com.apollographql.apollo3.runtime.java.interceptor.internal.DefaultInterceptorChain;
import com.apollographql.apollo3.runtime.java.internal.DefaultApolloCall;
import com.apollographql.apollo3.runtime.java.internal.DefaultApolloDisposable;
import com.apollographql.apollo3.runtime.java.network.NetworkTransport;
import com.apollographql.apollo3.runtime.java.network.http.HttpEngine;
import com.apollographql.apollo3.runtime.java.network.http.HttpInterceptor;
import com.apollographql.apollo3.runtime.java.network.http.HttpNetworkTransport;
import com.apollographql.apollo3.runtime.java.network.http.internal.BatchingHttpInterceptor;
import com.apollographql.apollo3.runtime.java.network.http.internal.OkHttpHttpEngine;
import com.apollographql.apollo3.runtime.java.network.ws.WebSocketNetworkTransport;
import com.apollographql.apollo3.runtime.java.network.ws.protocol.GraphQLWsProtocol;
import com.apollographql.apollo3.runtime.java.network.ws.protocol.WsProtocol;
import okhttp3.Call;
import okhttp3.OkHttpClient;
import okhttp3.WebSocket;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.Closeable;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import static com.apollographql.apollo3.api.java.Assertions.checkNotNull;
import static java.util.concurrent.Executors.newCachedThreadPool;
public class ApolloClient implements Closeable {
private Executor executor;
private List<ApolloInterceptor> interceptors;
private CustomScalarAdapters customScalarAdapters;
private NetworkInterceptor networkInterceptor;
private HttpMethod httpMethod;
private List<HttpHeader> httpHeaders;
private Boolean sendApqExtensions;
private Boolean sendDocument;
private Boolean enableAutoPersistedQueries;
private Boolean canBeBatched;
private ApolloClient(
Executor executor,
NetworkTransport httpNetworkTransport,
NetworkTransport subscriptionNetworkTransport,
List<ApolloInterceptor> interceptors,
CustomScalarAdapters customScalarAdapters,
HttpMethod httpMethod,
List<HttpHeader> httpHeaders,
Boolean sendApqExtensions,
Boolean sendDocument,
Boolean enableAutoPersistedQueries,
Boolean canBeBatched
) {
this.executor = executor;
this.interceptors = interceptors;
this.customScalarAdapters = customScalarAdapters;
this.httpMethod = httpMethod;
this.httpHeaders = httpHeaders;
this.sendApqExtensions = sendApqExtensions;
this.sendDocument = sendDocument;
this.enableAutoPersistedQueries = enableAutoPersistedQueries;
this.canBeBatched = canBeBatched;
networkInterceptor = new NetworkInterceptor(
httpNetworkTransport,
subscriptionNetworkTransport
);
}
public <D extends Query.Data> ApolloCall<D> query(@NotNull Query<D> operation) {
return new DefaultApolloCall<>(this, operation);
}
public <D extends Mutation.Data> ApolloCall<D> mutation(@NotNull Mutation<D> operation) {
return new DefaultApolloCall<>(this, operation);
}
public <D extends Subscription.Data> ApolloCall<D> subscription(@NotNull Subscription<D> operation) {
return new DefaultApolloCall<>(this, operation);
}
public <D extends Operation.Data> ApolloDisposable execute(@NotNull ApolloRequest<D> apolloRequest, @NotNull ApolloCallback<D> callback) {
ApolloRequest.Builder<D> requestBuilder = new ApolloRequest.Builder<>(apolloRequest.getOperation())
.addExecutionContext(customScalarAdapters)
.addExecutionContext(apolloRequest.getExecutionContext())
.httpMethod(httpMethod)
.httpHeaders(httpHeaders)
.sendApqExtensions(sendApqExtensions)
.sendDocument(sendDocument)
.enableAutoPersistedQueries(enableAutoPersistedQueries);
if (apolloRequest.getHttpMethod() != null) {
requestBuilder.httpMethod(apolloRequest.getHttpMethod());
}
if (apolloRequest.getHttpHeaders() != null) {
requestBuilder.httpHeaders(apolloRequest.getHttpHeaders());
}
if (apolloRequest.getSendApqExtensions() != null) {
requestBuilder.sendApqExtensions(apolloRequest.getSendApqExtensions());
}
if (apolloRequest.getSendDocument() != null) {
requestBuilder.sendDocument(apolloRequest.getSendDocument());
}
if (apolloRequest.getEnableAutoPersistedQueries() != null) {
requestBuilder.enableAutoPersistedQueries(apolloRequest.getEnableAutoPersistedQueries());
}
if (apolloRequest.getCanBeBatched() != null) {
requestBuilder.addHttpHeader(ExecutionOptions.CAN_BE_BATCHED, apolloRequest.getCanBeBatched().toString());
} else if (canBeBatched != null) {
requestBuilder.addHttpHeader(ExecutionOptions.CAN_BE_BATCHED, canBeBatched.toString());
}
DefaultApolloDisposable disposable = new DefaultApolloDisposable();
ArrayList<ApolloInterceptor> interceptors = new ArrayList<>(this.interceptors);
interceptors.add(networkInterceptor);
executor.execute(() -> new DefaultInterceptorChain(interceptors, 0, disposable).proceed(requestBuilder.build(), callback));
return disposable;
}
private static class NetworkInterceptor implements ApolloInterceptor {
private NetworkTransport httpNetworkTransport;
private NetworkTransport subscriptionNetworkTransport;
private NetworkInterceptor(NetworkTransport httpNetworkTransport, NetworkTransport subscriptionNetworkTransport) {
this.httpNetworkTransport = httpNetworkTransport;
this.subscriptionNetworkTransport = subscriptionNetworkTransport;
}
@Override
public <D extends Operation.Data> void intercept(@NotNull ApolloRequest<D> request, @NotNull ApolloInterceptorChain chain, @NotNull ApolloCallback<D> callback) {
if (request.getOperation() instanceof Query || request.getOperation() instanceof Mutation) {
httpNetworkTransport.execute(request, callback, chain.getDisposable());
} else {
subscriptionNetworkTransport.execute(request, callback, chain.getDisposable());
}
}
}
public CustomScalarAdapters getCustomScalarAdapters() {
return customScalarAdapters;
}
public void close() {
if (executor instanceof ApolloDefaultExecutor) {
((ApolloDefaultExecutor) executor).shutdown();
}
}
public static class Builder implements MutableExecutionOptions<Builder> {
private HttpEngine httpEngine;
private NetworkTransport networkTransport;
private NetworkTransport subscriptionNetworkTransport;
private String httpServerUrl;
private String webSocketServerUrl;
private Call.Factory callFactory;
private WebSocket.Factory webSocketFactory;
private Executor executor;
private List<ApolloInterceptor> interceptors = new ArrayList<>();
private List<HttpInterceptor> httpInterceptors = new ArrayList<>();
private WsProtocol.Factory wsProtocolFactory;
private List<HttpHeader> wsHeaders = new ArrayList<>();
private WebSocketNetworkTransport.ReopenWhen wsReopenWhen;
private Long wsIdleTimeoutMillis;
private final CustomScalarAdapters.Builder customScalarAdaptersBuilder = new CustomScalarAdapters.Builder();
private ExecutionContext executionContext;
private HttpMethod httpMethod;
private final ArrayList<HttpHeader> httpHeaders = new ArrayList<>();
private Boolean sendApqExtensions;
private Boolean sendDocument;
private Boolean enableAutoPersistedQueries;
private Boolean canBeBatched;
private Boolean httpExposeErrorBody;
private Boolean retryOnError;
public Builder() {
}
/**
* The url of the GraphQL server used for HTTP. This is the same as {@link #httpServerUrl(String)}. See also
* {@link #networkTransport(NetworkTransport)} for more customization
*/
public Builder serverUrl(String serverUrl) {
this.httpServerUrl = serverUrl;
return this;
}
/**
* The url of the GraphQL server used for HTTP. See also {@link #networkTransport(NetworkTransport)} for more customization
*/
public Builder httpServerUrl(String httpServerUrl) {
this.httpServerUrl = httpServerUrl;
return this;
}
/**
* The url of the GraphQL server used for WebSockets. See also {@link #subscriptionNetworkTransport(NetworkTransport)} for more
* customization
*/
public Builder webSocketServerUrl(String webSocketServerUrl) {
this.webSocketServerUrl = webSocketServerUrl;
return this;
}
/**
* Set the {@link OkHttpClient} to use for making network requests.
*
* @param okHttpClient the client to use.
* @return The {@link Builder} object to be used for chaining method calls
*/
public Builder okHttpClient(OkHttpClient okHttpClient) {
this.callFactory = okHttpClient;
this.webSocketFactory = okHttpClient;
return this;
}
/**
* Set the custom call factory for creating {@link Call} instances. <p> Note: Calling {@link #okHttpClient(OkHttpClient)} automatically
* sets this value.
*/
public Builder callFactory(Call.Factory factory) {
this.callFactory = factory;
return this;
}
/**
* Set the custom call factory for creating {@link WebSocket} instances. <p> Note: Calling {@link #okHttpClient(OkHttpClient)}
* automatically sets this value.
*/
public Builder webSocketFactory(WebSocket.Factory factory) {
this.webSocketFactory = factory;
return this;
}
/**
* The {@link Executor} to use for dispatching the requests.
*
* @return The {@link Builder} object to be used for chaining method calls
*/
public Builder dispatcher(Executor dispatcher) {
this.executor = dispatcher;
return this;
}
public Builder addInterceptor(ApolloInterceptor interceptor) {
this.interceptors.add(interceptor);
return this;
}
public Builder addInterceptors(@NotNull List<ApolloInterceptor> interceptors) {
this.interceptors.addAll(checkNotNull(interceptors, "interceptors is null"));
return this;
}
public Builder interceptors(@NotNull List<ApolloInterceptor> interceptors) {
this.interceptors = checkNotNull(interceptors, "interceptors is null");
return this;
}
public Builder addHttpInterceptor(@NotNull HttpInterceptor interceptor) {
this.httpInterceptors.add(checkNotNull(interceptor, "interceptor is null"));
return this;
}
public Builder addHttpInterceptors(@NotNull List<HttpInterceptor> interceptors) {
this.httpInterceptors.addAll(checkNotNull(interceptors, "interceptors is null"));
return this;
}
public Builder httpInterceptors(@NotNull List<HttpInterceptor> interceptors) {
this.httpInterceptors = checkNotNull(interceptors, "interceptors is null");
return this;
}
public Builder customScalarAdapters(@NotNull CustomScalarAdapters customScalarAdapters) {
this.customScalarAdaptersBuilder.clear();
this.customScalarAdaptersBuilder.addAll(customScalarAdapters);
return this;
}
/**
* Registers the given customScalarAdapter.
*
* @param customScalarType a generated {@link CustomScalarType}. Every GraphQL custom scalar has a generated class with a static `type`
* property. For an example, for a `Date` custom scalar, you can use `com.example.Date.type`
* @param customScalarAdapter the {@link Adapter} to use for this custom scalar
*/
public <T> Builder addCustomScalarAdapter(@NotNull CustomScalarType customScalarType, @NotNull Adapter<T> customScalarAdapter) {
customScalarAdaptersBuilder.add(customScalarType, customScalarAdapter);
return this;
}
public Builder wsProtocolFactory(WsProtocol.Factory wsProtocolFactory) {
this.wsProtocolFactory = wsProtocolFactory;
return this;
}
public Builder addWsHeader(@NotNull HttpHeader header) {
this.wsHeaders.add(checkNotNull(header, "header is null"));
return this;
}
public Builder addWsHeaders(@NotNull List<HttpHeader> headers) {
this.wsHeaders.addAll(checkNotNull(headers, "headers is null"));
return this;
}
public Builder wsHeaders(@NotNull List<HttpHeader> headers) {
this.wsHeaders = checkNotNull(headers, "headers is null");
return this;
}
public Builder wsReopenWhen(WebSocketNetworkTransport.ReopenWhen reopenWhen) {
this.wsReopenWhen = reopenWhen;
return this;
}
public Builder wsIdleTimeoutMillis(long wsIdleTimeoutMillis) {
this.wsIdleTimeoutMillis = wsIdleTimeoutMillis;
return this;
}
public Builder httpEngine(HttpEngine httpEngine) {
this.httpEngine = httpEngine;
return this;
}
public Builder httpExposeErrorBody(boolean httpExposeErrorBody) {
this.httpExposeErrorBody = httpExposeErrorBody;
return this;
}
public Builder networkTransport(NetworkTransport networkTransport) {
this.networkTransport = networkTransport;
return this;
}
public Builder subscriptionNetworkTransport(NetworkTransport subscriptionNetworkTransport) {
this.subscriptionNetworkTransport = subscriptionNetworkTransport;
return this;
}
@ApolloExperimental
public Builder retryOnError(RetryOnError retryOnError) {
throw new IllegalStateException("Not supported yet");
// this.retryOnError = retryOnError;
// return this;
}
public ApolloClient build() {
if (executor == null) {
executor = defaultExecutor();
}
NetworkTransport networkTransport;
if (this.networkTransport != null) {
if (httpServerUrl != null) throw new IllegalStateException("Apollo: 'httpServerUrl' has no effect if 'networkTransport' is set");
if (httpEngine != null) throw new IllegalStateException("Apollo: 'httpEngine' has no effect if 'networkTransport' is set");
if (callFactory != null) throw new IllegalStateException("Apollo: 'callFactory' has no effect if 'networkTransport' is set");
if (httpExposeErrorBody != null)
throw new IllegalStateException("Apollo: 'httpExposeErrorBody' has no effect if 'networkTransport' is set");
networkTransport = this.networkTransport;
} else {
checkNotNull(httpServerUrl, "serverUrl is missing");
if (callFactory != null) {
if (httpEngine != null) {
throw new IllegalStateException("Apollo: 'httpEngine' has no effect if 'callFactory' is set");
}
} else {
callFactory = new OkHttpClient();
}
if (httpEngine == null) {
httpEngine = new OkHttpHttpEngine(callFactory);
}
if (httpExposeErrorBody == null) {
httpExposeErrorBody = false;
}
networkTransport = new HttpNetworkTransport(new DefaultHttpRequestComposer(httpServerUrl), httpEngine, httpInterceptors, httpExposeErrorBody);
}
NetworkTransport subscriptionNetworkTransport;
if (this.subscriptionNetworkTransport != null) {
if (webSocketServerUrl != null)
throw new IllegalStateException("Apollo: 'webSocketServerUrl' has no effect if 'subscriptionNetworkTransport' is set");
if (webSocketFactory != null)
throw new IllegalStateException("Apollo: 'webSocketFactory' has no effect if 'subscriptionNetworkTransport' is set");
if (wsProtocolFactory != null)
throw new IllegalStateException("Apollo: 'wsProtocolFactory' has no effect if 'subscriptionNetworkTransport' is set");
if (wsHeaders != null)
throw new IllegalStateException("Apollo: 'wsHeaders' has no effect if 'subscriptionNetworkTransport' is set");
if (wsIdleTimeoutMillis != null)
throw new IllegalStateException("Apollo: 'wsIdleTimeoutMillis' has no effect if 'subscriptionNetworkTransport' is set");
subscriptionNetworkTransport = this.subscriptionNetworkTransport;
} else {
if (webSocketServerUrl == null) {
webSocketServerUrl = httpServerUrl;
}
if (webSocketServerUrl == null) {
// Fallback to the regular NetworkTransport. This is unlikely to work but chances are
// that the user is not going to use subscription, so it's better than failing
subscriptionNetworkTransport = networkTransport;
} else {
if (webSocketFactory == null) {
webSocketFactory = callFactory instanceof OkHttpClient ? (OkHttpClient) callFactory : new OkHttpClient();
}
if (wsProtocolFactory == null) {
wsProtocolFactory = new GraphQLWsProtocol.Factory();
}
if (wsReopenWhen == null) {
wsReopenWhen = (throwable, attempt) -> false;
}
if (wsIdleTimeoutMillis == null) {
wsIdleTimeoutMillis = 60_000L;
}
subscriptionNetworkTransport = new WebSocketNetworkTransport(
webSocketFactory,
wsProtocolFactory,
webSocketServerUrl,
wsHeaders,
wsReopenWhen,
executor,
wsIdleTimeoutMillis
);
}
}
return new ApolloClient(
executor,
networkTransport,
subscriptionNetworkTransport,
interceptors,
customScalarAdaptersBuilder.build(),
httpMethod,
httpHeaders,
sendApqExtensions,
sendDocument,
enableAutoPersistedQueries,
canBeBatched
);
}
public Builder autoPersistedQueries() {
return autoPersistedQueries(HttpMethod.Get, HttpMethod.Post, true);
}
public Builder autoPersistedQueries(
HttpMethod httpMethodForHashedQueries
) {
return autoPersistedQueries(httpMethodForHashedQueries, HttpMethod.Post, true);
}
public Builder autoPersistedQueries(
HttpMethod httpMethodForHashedQueries,
HttpMethod httpMethodForDocumentQueries
) {
return autoPersistedQueries(httpMethodForHashedQueries, httpMethodForDocumentQueries, true);
}
public Builder autoPersistedQueries(
HttpMethod httpMethodForHashedQueries,
HttpMethod httpMethodForDocumentQueries,
boolean enableByDefault
) {
addInterceptor(
new AutoPersistedQueryInterceptor(
httpMethodForHashedQueries,
httpMethodForDocumentQueries
)
);
enableAutoPersistedQueries(enableByDefault);
return this;
}
/**
* Batch HTTP queries to execute multiple at once. This reduces the number of HTTP round trips at the price of increased latency as
* every request in the batch is now as slow as the slowest one. Some servers might have a per-HTTP-call cache making it faster to
* resolve 1 big array of n queries compared to resolving the n queries separately.
* <p>
* See also {@link BatchingHttpInterceptor}.
*
* @param batchIntervalMillis the interval between two batches
* @param maxBatchSize always send the batch when this threshold is reached
*/
public Builder httpBatching(long batchIntervalMillis, int maxBatchSize, boolean enableByDefault) {
addHttpInterceptor(new BatchingHttpInterceptor(batchIntervalMillis, maxBatchSize, httpExposeErrorBody != null && httpExposeErrorBody));
canBeBatched(enableByDefault);
return this;
}
@NotNull @Override public ExecutionContext getExecutionContext() {
return executionContext;
}
@Nullable @Override public HttpMethod getHttpMethod() {
return httpMethod;
}
@Nullable @Override public List<HttpHeader> getHttpHeaders() {
return httpHeaders;
}
@Nullable @Override public Boolean getSendApqExtensions() {
return sendApqExtensions;
}
@Nullable @Override public Boolean getSendDocument() {
return sendDocument;
}
@Nullable @Override public Boolean getEnableAutoPersistedQueries() {
return enableAutoPersistedQueries;
}
@Nullable @Override public Boolean getCanBeBatched() {
return canBeBatched;
}
@Override public Builder addExecutionContext(@NotNull ExecutionContext executionContext) {
this.executionContext = this.executionContext.plus(executionContext);
return this;
}
@Override public Builder httpMethod(@Nullable HttpMethod httpMethod) {
this.httpMethod = httpMethod;
return this;
}
@Override public Builder httpHeaders(@Nullable List<HttpHeader> list) {
this.httpHeaders.clear();
this.httpHeaders.addAll(list);
return this;
}
@Override public Builder addHttpHeader(@NotNull String name, @NotNull String value) {
this.httpHeaders.add(new HttpHeader(name, value));
return this;
}
@Override public Builder sendApqExtensions(@Nullable Boolean sendApqExtensions) {
this.sendApqExtensions = sendApqExtensions;
return this;
}
@Override public Builder sendDocument(@Nullable Boolean sendDocument) {
this.sendDocument = sendDocument;
return this;
}
@Override public Builder enableAutoPersistedQueries(@Nullable Boolean enableAutoPersistedQueries) {
this.enableAutoPersistedQueries = enableAutoPersistedQueries;
return this;
}
@Override public Builder canBeBatched(@Nullable Boolean canBeBatched) {
this.canBeBatched = canBeBatched;
return this;
}
}
private static class ApolloDefaultExecutor implements Executor {
private final ExecutorService executor = newCachedThreadPool(runnable -> new Thread(runnable, "Apollo Dispatcher"));
@Override public void execute(@NotNull Runnable command) {
executor.execute(command);
}
public void shutdown() {
executor.shutdown();
}
}
static private Executor defaultExecutor() {
return new ApolloDefaultExecutor();
}
@ApolloExperimental
interface RetryOnError {
boolean retryOnError(ApolloRequest request);
}
}