open class ExponentialBackOff : BackOff
Implementation of BackOff that increases the back off period for each retry attempt. When the interval has reached the max interval, it is no longer increased. Stops retrying once the max elapsed time has been reached.
Example: The default interval is {@value #DEFAULT_INITIAL_INTERVAL} ms, the default multiplier is {@value #DEFAULT_MULTIPLIER}, and the default max interval is {@value #DEFAULT_MAX_INTERVAL}. For 10 attempts the sequence will be as follows:
request# back off 1 2000 2 3000 3 4500 4 6750 5 10125 6 15187 7 22780 8 30000 9 30000 10 30000
Note that the default max elapsed time is Long#MAX_VALUE. Use #setMaxElapsedTime(long) to limit the maximum length of time that an instance should accumulate before returning BackOffExecution#STOP.
Author
Stephane Nicoll
Since
4.1
ExponentialBackOff()
Create an instance with the default settings. ExponentialBackOff(initialInterval: Long, multiplier: Double)
Create an instance with the supplied settings. |
static val DEFAULT_INITIAL_INTERVAL: Long
The default initial interval. |
|
static val DEFAULT_MAX_ELAPSED_TIME: Long
The default maximum elapsed time. |
|
static val DEFAULT_MAX_INTERVAL: Long
The default maximum back off time. |
|
static val DEFAULT_MULTIPLIER: Double
The default multiplier (increases the interval by 50%). |
open fun getInitialInterval(): Long
Return the initial interval in milliseconds. |
|
open fun getMaxElapsedTime(): Long
Return the maximum elapsed time in milliseconds after which a call to |
|
open fun getMaxInterval(): Long
Return the maximum back off time. |
|
open fun getMultiplier(): Double
Return the value to multiply the current interval by for each retry attempt. |
|
open fun setInitialInterval(initialInterval: Long): Unit
The initial interval in milliseconds. |
|
open fun setMaxElapsedTime(maxElapsedTime: Long): Unit
The maximum elapsed time in milliseconds after which a call to |
|
open fun setMaxInterval(maxInterval: Long): Unit
The maximum back off time. |
|
open fun setMultiplier(multiplier: Double): Unit
The value to multiply the current interval by for each retry attempt. |
|
open fun start(): BackOffExecution |