@@ -24,6 +24,7 @@ public final class LDConfig {
24
24
private static final long DEFAULT_POLLING_INTERVAL_MILLIS = 1000L ;
25
25
private static final long DEFAULT_START_WAIT_MILLIS = 5000L ;
26
26
private static final int DEFAULT_SAMPLING_INTERVAL = 0 ;
27
+ private static final long DEFAULT_RECONNECT_TIME_MILLIS = 1000 ;
27
28
private static final Logger logger = LoggerFactory .getLogger (LDConfig .class );
28
29
29
30
protected static final LDConfig DEFAULT = new Builder ().build ();
@@ -43,6 +44,7 @@ public final class LDConfig {
43
44
final long pollingIntervalMillis ;
44
45
final long startWaitMillis ;
45
46
final int samplingInterval ;
47
+ final long reconnectTimeMs ;
46
48
47
49
protected LDConfig (Builder builder ) {
48
50
this .baseURI = builder .baseURI ;
@@ -64,6 +66,7 @@ protected LDConfig(Builder builder) {
64
66
}
65
67
this .startWaitMillis = builder .startWaitMillis ;
66
68
this .samplingInterval = builder .samplingInterval ;
69
+ this .reconnectTimeMs = builder .reconnectTimeMs ;
67
70
}
68
71
69
72
/**
@@ -95,6 +98,7 @@ public static class Builder {
95
98
private FeatureStore featureStore = new InMemoryFeatureStore ();
96
99
private long startWaitMillis = DEFAULT_START_WAIT_MILLIS ;
97
100
private int samplingInterval = DEFAULT_SAMPLING_INTERVAL ;
101
+ private long reconnectTimeMs = DEFAULT_RECONNECT_TIME_MILLIS ;
98
102
99
103
/**
100
104
* Creates a builder with all configuration parameters set to the default
@@ -341,6 +345,20 @@ public Builder samplingInterval(int samplingInterval) {
341
345
return this ;
342
346
}
343
347
348
+ /**
349
+ * The reconnect base time in milliseconds for the streaming connection. The streaming connection
350
+ * uses an exponential backoff algorithm (with jitter) for reconnects, but will start the backoff
351
+ * with a value near the value specified here.
352
+ *
353
+ * @param reconnectTimeMs the reconnect time base value in milliseconds
354
+ * @return the builder
355
+ */
356
+ public Builder reconnectTimeMs (long reconnectTimeMs ) {
357
+ this .reconnectTimeMs = reconnectTimeMs ;
358
+ return this ;
359
+ }
360
+
361
+
344
362
HttpHost proxyHost () {
345
363
if (this .proxyHost == null && this .proxyPort == -1 && this .proxyScheme == null ) {
346
364
return null ;
0 commit comments