@@ -24,6 +24,7 @@ public final class LDConfig {
2424 private static final long DEFAULT_POLLING_INTERVAL_MILLIS = 1000L ;
2525 private static final long DEFAULT_START_WAIT_MILLIS = 5000L ;
2626 private static final int DEFAULT_SAMPLING_INTERVAL = 0 ;
27+ private static final long DEFAULT_RECONNECT_TIME_MILLIS = 1000 ;
2728 private static final Logger logger = LoggerFactory .getLogger (LDConfig .class );
2829
2930 protected static final LDConfig DEFAULT = new Builder ().build ();
@@ -43,6 +44,7 @@ public final class LDConfig {
4344 final long pollingIntervalMillis ;
4445 final long startWaitMillis ;
4546 final int samplingInterval ;
47+ final long reconnectTimeMs ;
4648
4749 protected LDConfig (Builder builder ) {
4850 this .baseURI = builder .baseURI ;
@@ -64,6 +66,7 @@ protected LDConfig(Builder builder) {
6466 }
6567 this .startWaitMillis = builder .startWaitMillis ;
6668 this .samplingInterval = builder .samplingInterval ;
69+ this .reconnectTimeMs = builder .reconnectTimeMs ;
6770 }
6871
6972 /**
@@ -95,6 +98,7 @@ public static class Builder {
9598 private FeatureStore featureStore = new InMemoryFeatureStore ();
9699 private long startWaitMillis = DEFAULT_START_WAIT_MILLIS ;
97100 private int samplingInterval = DEFAULT_SAMPLING_INTERVAL ;
101+ private long reconnectTimeMs = DEFAULT_RECONNECT_TIME_MILLIS ;
98102
99103 /**
100104 * Creates a builder with all configuration parameters set to the default
@@ -341,6 +345,20 @@ public Builder samplingInterval(int samplingInterval) {
341345 return this ;
342346 }
343347
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+
344362 HttpHost proxyHost () {
345363 if (this .proxyHost == null && this .proxyPort == -1 && this .proxyScheme == null ) {
346364 return null ;
0 commit comments