org.springframework.retry.support
Class RetrySimulator
java.lang.Object
org.springframework.retry.support.RetrySimulator
public class RetrySimulator
- extends Object
A 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.
- Author:
- Jon Travis
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RetrySimulator
public RetrySimulator(SleepingBackOffPolicy<?> backOffPolicy,
RetryPolicy retryPolicy)
executeSimulation
public RetrySimulation executeSimulation(int numSimulations)
- Execute the simulator for a give # of iterations.
- Parameters:
numSimulations - Number of simulations to run
- Returns:
- the outcome of all simulations
executeSingleSimulation
public List<Long> executeSingleSimulation()
- Execute a single simulation
- Returns:
- The sleeps which occurred within the single simulation.
Copyright © 2013 SpringSource. All Rights Reserved.