spring-framework / org.springframework.util.backoff

Package org.springframework.util.backoff

Types

ExponentialBackOff

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.

FixedBackOff

open class FixedBackOff : BackOff

A simple BackOff implementation that provides a fixed interval between two attempts and a maximum number of retries.