Class RetryingHttpClient
- java.lang.Object
-
- com.linecorp.armeria.client.DecoratingClient<I,O,I,O>
-
- com.linecorp.armeria.client.SimpleDecoratingClient<I,O>
-
- com.linecorp.armeria.client.retry.RetryingClient<HttpRequest,HttpResponse>
-
- com.linecorp.armeria.client.retry.RetryingHttpClient
-
- All Implemented Interfaces:
Client<HttpRequest,HttpResponse>
public final class RetryingHttpClient extends RetryingClient<HttpRequest,HttpResponse>
AClient
decorator that handles failures of an invocation and retries HTTP requests.
-
-
Field Summary
-
Fields inherited from class com.linecorp.armeria.client.retry.RetryingClient
ARMERIA_RETRY_COUNT
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected HttpResponse
doExecute(ClientRequestContext ctx, HttpRequest req)
Invoked byRetryingClient.execute(ClientRequestContext, Request)
after the deadline for response timeout is set.static Function<Client<HttpRequest,HttpResponse>,RetryingHttpClient>
newDecorator(RetryStrategy retryStrategy)
Creates a newClient
decorator that handles failures of an invocation and retries HTTP requests.static Function<Client<HttpRequest,HttpResponse>,RetryingHttpClient>
newDecorator(RetryStrategy retryStrategy, int maxTotalAttempts)
Creates a newClient
decorator that handles failures of an invocation and retries HTTP requests.static Function<Client<HttpRequest,HttpResponse>,RetryingHttpClient>
newDecorator(RetryStrategy retryStrategy, int maxTotalAttempts, long responseTimeoutMillisForEachAttempt)
Creates a newClient
decorator that handles failures of an invocation and retries HTTP requests.-
Methods inherited from class com.linecorp.armeria.client.retry.RetryingClient
execute, getNextDelay, getNextDelay, getTotalAttempts, onRetryingComplete, retryStrategy, retryStrategyWithContent, scheduleNextRetry, setResponseTimeout
-
Methods inherited from class com.linecorp.armeria.client.DecoratingClient
delegate, toString
-
-
-
-
Method Detail
-
newDecorator
public static Function<Client<HttpRequest,HttpResponse>,RetryingHttpClient> newDecorator(RetryStrategy retryStrategy)
Creates a newClient
decorator that handles failures of an invocation and retries HTTP requests.- Parameters:
retryStrategy
- the retry strategy
-
newDecorator
public static Function<Client<HttpRequest,HttpResponse>,RetryingHttpClient> newDecorator(RetryStrategy retryStrategy, int maxTotalAttempts)
Creates a newClient
decorator that handles failures of an invocation and retries HTTP requests.- Parameters:
retryStrategy
- the retry strategymaxTotalAttempts
- the maximum number of total attempts
-
newDecorator
public static Function<Client<HttpRequest,HttpResponse>,RetryingHttpClient> newDecorator(RetryStrategy retryStrategy, int maxTotalAttempts, long responseTimeoutMillisForEachAttempt)
Creates a newClient
decorator that handles failures of an invocation and retries HTTP requests.- Parameters:
retryStrategy
- the retry strategymaxTotalAttempts
- the maximum number of total attemptsresponseTimeoutMillisForEachAttempt
- response timeout for each attempt.0
disables the timeout
-
doExecute
protected HttpResponse doExecute(ClientRequestContext ctx, HttpRequest req) throws Exception
Description copied from class:RetryingClient
Invoked byRetryingClient.execute(ClientRequestContext, Request)
after the deadline for response timeout is set.- Specified by:
doExecute
in classRetryingClient<HttpRequest,HttpResponse>
- Throws:
Exception
-
-