Interface IterationContext<T>
- Type Parameters:
T- Application context type
- All Known Subinterfaces:
RepeatContext<T>,RetryContext<T>
- All Known Implementing Classes:
DefaultContext
public interface IterationContext<T>
Context provided to retry or repeat callbacks.
-
Method Summary
Modifier and TypeMethodDescriptionApplication context that may be used to perform any rollbacks before a retry.backoff()The backoff delay.longThe next iteration number.
-
Method Details
-
applicationContext
T applicationContext()Application context that may be used to perform any rollbacks before a retry. Application context can be configured usingRetry.withApplicationContext(Object)orRepeat.withApplicationContext(Object).- Returns:
- application context
-
iteration
long iteration()The next iteration number. This is a zero-based incrementing number with the first attempt prior to any retries as iteration zero.- Returns:
- the current iteration number
-
backoff
Duration backoff()The backoff delay. WhenBackofffunction is invoked, the previous backoff is provided in the context. The context provided for the retry predicatesRetry.onlyIf(java.util.function.Predicate)andRepeat.onlyIf(java.util.function.Predicate)as well as the retry callbacksRetry.doOnRetry(java.util.function.Consumer)andRepeat.doOnRepeat(java.util.function.Consumer)provide the backoff delay for the next retry.- Returns:
- Backoff delay
-