Interface RetryStrategy
-
- All Known Implementing Classes:
ExponentialBackoff
,FixedDelay
public interface RetryStrategy
The interface for determining the retry strategy used inRetryPolicy
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description org.threeten.bp.Duration
calculateRetryDelay(HttpResponse response, java.lang.Throwable error, int retryAttempts)
Determines the delay duration that should be waited before retrying.int
getMaxRetries()
Get the maximum number of times to retry.default boolean
shouldRetry(HttpResponse response, java.lang.Throwable error, int retryAttempts)
Determines any retry should be performed.
-
-
-
Method Detail
-
getMaxRetries
int getMaxRetries()
Get the maximum number of times to retry.- Returns:
- The maximum number of times to retry.
-
shouldRetry
default boolean shouldRetry(HttpResponse response, java.lang.Throwable error, int retryAttempts)
Determines any retry should be performed.- Parameters:
response
- The HTTP response.error
- The pipeline exception, if any.retryAttempts
- The number of retry attempts so far made.- Returns:
- True to retry, false to exit retry loop.
-
calculateRetryDelay
org.threeten.bp.Duration calculateRetryDelay(HttpResponse response, java.lang.Throwable error, int retryAttempts)
Determines the delay duration that should be waited before retrying.- Parameters:
response
- The HTTP response.error
- The pipeline exception, if any.retryAttempts
- The number of retry attempts so far made.- Returns:
- The delay duration.
-
-