public static class ReconnectOptions.Builder extends Object
| Modifier | Constructor and Description |
|---|---|
protected |
Builder() |
| Modifier and Type | Method and Description |
|---|---|
ReconnectOptions |
build() |
ReconnectOptions.Builder |
setBackoff(Backoff backoff)
Deprecated.
only select implementations will use this value. Moving forward, consider assuming an
exponential backoff function bounded by
ReconnectOptions.getFirstBackoff() and ReconnectOptions.getMaxBackoffInterval() |
ReconnectOptions.Builder |
setBackoffScheduler(Scheduler backoffScheduler)
Set the
Scheduler to be used when building delayed sequences as backoff. |
ReconnectOptions.Builder |
setFirstBackoff(Duration firstBackoff)
Set the first
Duration to be applied when computing a backoff. |
ReconnectOptions.Builder |
setJitter(Jitter jitter)
Deprecated.
only select implementations will use this value. Moving forward, consider using
setJitterFactor(double)} |
ReconnectOptions.Builder |
setJitterFactor(double jitterFactor)
Set a jitter factor for exponential backoff that adds randomness to each backoff.
|
ReconnectOptions.Builder |
setMaxBackoffInterval(Duration maxBackoffInterval)
Set the maximum
Duration to be applied when computing a backoff. |
ReconnectOptions.Builder |
setMaxRetries(long maxRetries)
Set the maximum number of iterations to retry before rethrowing the error as exhausted attempts.
|
public ReconnectOptions.Builder setFirstBackoff(Duration firstBackoff)
Duration to be applied when computing a backoff. Defaults to 2 seconds.firstBackoff - the minimum duration to be applied as backoffpublic ReconnectOptions.Builder setMaxBackoffInterval(Duration maxBackoffInterval)
Duration to be applied when computing a backoff. Defaults to 30 seconds.maxBackoffInterval - the maximum duration to be applied as backoffpublic ReconnectOptions.Builder setMaxRetries(long maxRetries)
maxRetries - the maximum number of retries@Deprecated public ReconnectOptions.Builder setBackoff(Backoff backoff)
ReconnectOptions.getFirstBackoff() and ReconnectOptions.getMaxBackoffInterval()Backoff type. Defaults to an exponential backoff
strategy that uses a context object for obtaining the actual iteration.backoff - a backoff function to apply on retries@Deprecated public ReconnectOptions.Builder setJitter(Jitter jitter)
setJitterFactor(double)}Jitter type. Defaults to 50% randomness.jitter - a jitter function to apply on retriespublic ReconnectOptions.Builder setBackoffScheduler(Scheduler backoffScheduler)
Scheduler to be used when building delayed sequences as backoff. Defaults to dedicated
parallel scheduler ReconnectOptions.DEFAULT_BACKOFF_SCHEDULER.backoffScheduler - a reactor scheduler used for backoff delayspublic ReconnectOptions.Builder setJitterFactor(double jitterFactor)
0.5
(a jitter of at most 50% of the computed delay)jitterFactor - the new jitter factor as a double between 0d and 1dpublic ReconnectOptions build()