public class RetrySimulator extends Object
RetrySimulator
is a tool for exercising retry + backoff operations.
When calibrating a set of retry + backoff pairs, it is useful to know the behaviour
of the retry for various scenarios.
Things you may want to know:
- Does a 'maxInterval' of 5000 ms in my backoff even matter?
(This is often the case when retry counts are low -- so why set the max interval
at something that cannot be achieved?)
- What are the typical sleep durations for threads in a retry
- What was the longest sleep duration for any retry sequence
The simulator provides this information by executing a retry + backoff pair until failure
(that is all retries are exhausted). The information about each retry is provided
as part of the RetrySimulation
.
Note that the impetus for this class was to expose the timings which are possible with
ExponentialRandomBackOffPolicy
, which provides
random values and must be looked at over a series of trials.Constructor and Description |
---|
RetrySimulator(SleepingBackOffPolicy<?> backOffPolicy,
RetryPolicy retryPolicy) |
Modifier and Type | Method and Description |
---|---|
RetrySimulation |
executeSimulation(int numSimulations)
Execute the simulator for a give # of iterations.
|
List<Long> |
executeSingleSimulation()
Execute a single simulation
|
public RetrySimulator(SleepingBackOffPolicy<?> backOffPolicy, RetryPolicy retryPolicy)
public RetrySimulation executeSimulation(int numSimulations)
numSimulations
- Number of simulations to runCopyright © 2018 SpringSource. All rights reserved.