Package kong.unirest.core
Interface RetryStrategy
- All Known Implementing Classes:
RetryStrategy.Standard
public interface RetryStrategy
A Strategy for performing retries.
Comes with a standard implementation which follows spec
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classA standard implementation of the RetryStrategy which follows spec based Retry-After logic - Will attempt a retry on any 301, 429, 503, or 529 response which is accompanied by a Retry-After header. -
Method Summary
Modifier and TypeMethodDescriptionintGet the max number of times the Unirest should retry responses before giving up and allowing a final returnlonggetWaitTime(HttpResponse<?> response) Get the number of milliseconds the system should wait before retrying.booleanisRetryable(HttpResponse<?> response) Checks to see if the response is retryabledefault voidwaitFor(long millies) Puts the current executing thread to sleep for the specified millis
-
Method Details
-
isRetryable
Checks to see if the response is retryable- Parameters:
response- the last response- Returns:
- a bool indicating if the request should be retried
-
getWaitTime
Get the number of milliseconds the system should wait before retrying. A value less than 1 will result in the termination of the retry loop- Parameters:
response- the last response- Returns:
- millies
-
getMaxAttempts
int getMaxAttempts()Get the max number of times the Unirest should retry responses before giving up and allowing a final return- Returns:
- the max attempts
-
waitFor
default void waitFor(long millies) Puts the current executing thread to sleep for the specified millis- Parameters:
millies- sleepy time millies
-