I
- the request typeO
- the response type@FunctionalInterface public interface RetryStrategy<I extends Request,O extends Response>
Modifier and Type | Method and Description |
---|---|
static <I extends Request,O extends Response> |
never()
A
RetryStrategy that defines a retry should not be performed. |
static RetryStrategy<HttpRequest,HttpResponse> |
onStatus(HttpStatus... retryStatuses)
Returns the
RetryStrategy that decides to retry the request using HTTP statuses. |
static RetryStrategy<HttpRequest,HttpResponse> |
onStatus(Iterable<HttpStatus> retryStatuses)
Returns the
RetryStrategy that decides to retry the request using HTTP statuses. |
CompletableFuture<Boolean> |
shouldRetry(I request,
O response)
Returns
CompletableFuture that contains a Boolean flag which indicates whether
RetryingClient needs to retry or not. |
default boolean |
shouldRetry(I request,
Throwable thrown)
Returns whether an exception should be retried according to the given request and response.
|
static <I extends Request,O extends Response> RetryStrategy<I,O> never()
RetryStrategy
that defines a retry should not be performed.static RetryStrategy<HttpRequest,HttpResponse> onStatus(HttpStatus... retryStatuses)
RetryStrategy
that decides to retry the request using HTTP statuses.static RetryStrategy<HttpRequest,HttpResponse> onStatus(Iterable<HttpStatus> retryStatuses)
RetryStrategy
that decides to retry the request using HTTP statuses.CompletableFuture<Boolean> shouldRetry(I request, O response)
CompletableFuture
that contains a Boolean
flag which indicates whether
RetryingClient
needs to retry or not.
If an Exception
occurs while processing Request
and Response
, this method
should not complete the CompletableFuture
with the Exception
. The Exception
needs to be dealt in the shouldRetry(Request, Throwable)
method, and
the CompletableFuture
has to be completed with false
.
© Copyright 2015–2017 LINE Corporation. All rights reserved.