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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description TapplicationContext()Application context that may be used to perform any rollbacks before a retry.Durationbackoff()The backoff delay.longiteration()The next iteration number.
-
-
-
Method Detail
-
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
-
-