java.lang.Object
io.helidon.faulttolerance.Retry.DelayingRetryPolicy
- All Implemented Interfaces:
Retry.RetryPolicy
- Enclosing interface:
Retry
A retry policy that prolongs the delays between retries by a defined factor.
Consider the following setup:
calls = 4delayMillis = 100factor = 2.0
- Initial call - always immediate (not handled by retry policy)
- First retry - 100 millis
- Second retry - 200 millis (previous delay * factor)
- Third retry - 400 millis (previous delay * factor)
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionbuilder()A builder to customize configuration ofRetry.DelayingRetryPolicy.nextDelayMillis(long firstCallMillis, long lastDelay, int call) Return next delay in milliseconds, or an empty optional to finish retries.static Retry.DelayingRetryPolicynoDelay(int calls) Create a retry policy with no delays and with the specified number of calls.
-
Method Details
-
builder
A builder to customize configuration ofRetry.DelayingRetryPolicy.- Returns:
- a new builder
-
noDelay
Create a retry policy with no delays and with the specified number of calls.- Parameters:
calls- number of calls to execute (retries + initial call)- Returns:
- a no delay retry policy
-
nextDelayMillis
Description copied from interface:Retry.RetryPolicyReturn next delay in milliseconds, or an empty optional to finish retries.- Specified by:
nextDelayMillisin interfaceRetry.RetryPolicy- 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
-