Package org.springframework.util.backoff
Interface BackOff
- All Known Implementing Classes:
ExponentialBackOff
,FixedBackOff
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface BackOff
Provide aBackOffExecution
that indicates the rate at which an operation should be retried.Users of this interface are expected to use it like this:
BackOffExecution exec = backOff.start(); // In the operation recovery/retry loop: long waitInterval = exec.nextBackOff(); if (waitInterval == BackOffExecution.STOP) { // do not retry operation } else { // sleep, e.g. Thread.sleep(waitInterval) // retry operation } }
Once the underlying operation has completed successfully, the execution instance can be simply discarded.- Since:
- 4.1
- Author:
- Stephane Nicoll
- See Also:
BackOffExecution
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description BackOffExecution
start()
Start a new back off execution.
Method Detail
start
BackOffExecution start()
Start a new back off execution.- Returns:
- a fresh
BackOffExecution
ready to be used