- All Known Implementing Classes:
Retry.DelayingRetryPolicy
,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
Modifier and TypeMethodDescriptionnextDelayMillis
(long firstCallMillis, long lastDelay, int call) Return next delay in milliseconds, or an empty optional to finish retries.
-
Method Details
-
nextDelayMillis
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
-