public class ExponentialRandomBackOffPolicy extends ExponentialBackOffPolicy
ExponentialBackOffPolicy that
chooses a random multiple of the interval. The random multiple is selected based on
how many iterations have occurred.
This has shown to at least be useful in testing scenarios where excessive contention is generated
by the test needing many retries. In test, usually threads are started at the same time, and thus
stomp together onto the next interval. Using this BackOffPolicy can help avoid that scenario.
Example:
initialInterval = 50
multiplier = 2.0
maxInterval = 3000
numRetries = 5
ExponentialBackOffPolicy yields: [50, 100, 200, 400, 800]
ExponentialRandomBackOffPolicy may yield [50, 100, 100, 100, 600]
or [50, 100, 150, 400, 800]DEFAULT_INITIAL_INTERVAL, DEFAULT_MAX_INTERVAL, DEFAULT_MULTIPLIER, logger| Constructor and Description |
|---|
ExponentialRandomBackOffPolicy() |
| Modifier and Type | Method and Description |
|---|---|
protected ExponentialBackOffPolicy |
newInstance() |
BackOffContext |
start(RetryContext context)
Returns a new instance of
BackOffContext, seeded with this
policies settings. |
backOff, cloneValues, getInitialInterval, getMaxInterval, getMultiplier, setInitialInterval, setMaxInterval, setMultiplier, setSleeper, toString, withSleeperpublic BackOffContext start(RetryContext context)
BackOffContext, seeded with this
policies settings.start in interface BackOffPolicystart in class ExponentialBackOffPolicycontext - the current retry context, which might contain information
that we can use to decide how to proceed.BackOffContext or 'null'.protected ExponentialBackOffPolicy newInstance()
newInstance in class ExponentialBackOffPolicyCopyright © 2014 SpringSource. All rights reserved.