public class ExponentialReconnectionPolicy extends Object implements ReconnectionPolicy
ReconnectionPolicy.ReconnectionSchedule
Constructor and Description |
---|
ExponentialReconnectionPolicy(long baseDelayMs,
long maxDelayMs)
Creates a reconnection policy waiting exponentially longer for each new attempt.
|
Modifier and Type | Method and Description |
---|---|
long |
getBaseDelayMs()
The base delay in milliseconds for this policy (e.g.
|
long |
getMaxDelayMs()
The maximum delay in milliseconds between reconnection attempts for this policy.
|
ReconnectionPolicy.ReconnectionSchedule |
newSchedule()
A new schedule that used an exponentially growing delay between reconnection attempts.
|
public ExponentialReconnectionPolicy(long baseDelayMs, long maxDelayMs)
baseDelayMs
- the base delay in milliseconds to use for
the schedules created by this policy.maxDelayMs
- the maximum delay to wait between two attempts.public long getBaseDelayMs()
public long getMaxDelayMs()
public ReconnectionPolicy.ReconnectionSchedule newSchedule()
For this schedule, reconnection attempt i
will be tried
Math.min(2^(i-1) * getBaseDelayMs(), getMaxDelayMs())
milliseconds after the previous one.
newSchedule
in interface ReconnectionPolicy
Copyright © 2014. All Rights Reserved.