A reconnection policy that waits exponentially longer between each
reconnection attempt (but keeps a constant delay once a maximum delay is
Creates a reconnection policy waiting exponentially longer for each new attempt.
baseDelayMs the base delay in milliseconds to use for
the schedules created by this policy.
maxDelayMs the maximum delay to wait between two attempts.
if (baseDelayMs < 0 || maxDelayMs < 0)
if (maxDelayMs < baseDelayMs)
int ceil = (baseDelayMs & (baseDelayMs - 1)) == 0 ? 0 : 1;
The base delay in milliseconds for this policy (e.g. the delay before
the first reconnection attempt).
- the base delay in milliseconds for this policy.
The maximum delay in milliseconds between reconnection attempts for this policy.
- the maximum delay in milliseconds between reconnection attempts for this policy.
A new schedule that used an exponentially growing delay between reconnection attempts.
For this schedule, reconnection attempt
i will be tried
Math.min(2^(i-1) * getBaseDelayMs(), getMaxDelayMs()) milliseconds after the previous one.
- the newly created schedule.