-
- All Known Implementing Classes:
Retry.DelayingRetryPolicy
,Retry.ExponentialRetryPolicy
,Retry.FibonacciRetryPolicy
,Retry.JitterRetryPolicy
- Enclosing interface:
- Retry
public static interface Retry.RetryPolicy
Retry policy to handle delays between retries. The implementation must not save state, as a single instance will be used by multiple threads and executions in parallel.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Optional<Long>
nextDelayMillis(long firstCallMillis, long lastDelay, int call)
Return next delay in milliseconds, or an empty optional to finish retries.
-
-
-
Method Detail
-
nextDelayMillis
Optional<Long> nextDelayMillis(long firstCallMillis, long lastDelay, int call)
Return next delay in milliseconds, or an empty optional to finish retries.- Parameters:
firstCallMillis
- milliseconds recorded before the first call usingSystem.currentTimeMillis()
lastDelay
- last delay that was used (0 for the first failed call)call
- call index (0 for the first failed call)- Returns:
- how long to wait before trying again, or empty to notify this is the end of retries
-
-