Class RetryingClientBuilder
java.lang.Object
com.linecorp.armeria.client.retry.AbstractRetryingClientBuilder<HttpResponse>
com.linecorp.armeria.client.retry.RetryingClientBuilder
Builds a new
RetryingClient
or its decorator function.-
Method Summary
Modifier and TypeMethodDescriptionbuild
(HttpClient delegate) Returns a newly-createdRetryingClient
based on the properties of this builder.maxTotalAttempts
(int maxTotalAttempts) Sets the maximum allowed number of total attempts.Function<? super HttpClient,
RetryingClient> Returns a newly-created decorator that decorates anHttpClient
with a newRetryingClient
based on the properties of this builder.responseTimeoutForEachAttempt
(Duration responseTimeoutForEachAttempt) Sets the response timeout for each attempt.responseTimeoutMillisForEachAttempt
(long responseTimeoutMillisForEachAttempt) Sets the response timeout for each attempt in milliseconds.toString()
useRetryAfter
(boolean useRetryAfter) Whether retry should be attempted according to theretryHeader
from the server or not.
-
Method Details
-
useRetryAfter
Whether retry should be attempted according to theretryHeader
from the server or not. The web server may request a client to retry after specific time withretryAfter
header. If you want to follow the direction from the server not by yourBackoff
, invoke this method with theuseRetryAfter
withtrue
to request after the specified delay.- Parameters:
useRetryAfter
-true
if you want to retry after using theretryAfter
header.false
otherwise- Returns:
RetryingClientBuilder
to support method chaining
-
build
Returns a newly-createdRetryingClient
based on the properties of this builder. -
newDecorator
Returns a newly-created decorator that decorates anHttpClient
with a newRetryingClient
based on the properties of this builder. -
toString
- Overrides:
toString
in classAbstractRetryingClientBuilder<HttpResponse>
-
maxTotalAttempts
Description copied from class:AbstractRetryingClientBuilder
Sets the maximum allowed number of total attempts. If unspecified, the value fromFlags.defaultMaxTotalAttempts()
will be used.- Overrides:
maxTotalAttempts
in classAbstractRetryingClientBuilder<HttpResponse>
- Returns:
this
to support method chaining.
-
responseTimeoutMillisForEachAttempt
public RetryingClientBuilder responseTimeoutMillisForEachAttempt(long responseTimeoutMillisForEachAttempt) Description copied from class:AbstractRetryingClientBuilder
Sets the response timeout for each attempt in milliseconds. When requests inAbstractRetryingClient
are made, corresponding responses are timed out by this value.0
disables the timeout. It will be set by the default value inFlags.defaultResponseTimeoutMillis()
, if the client does not specify.- Overrides:
responseTimeoutMillisForEachAttempt
in classAbstractRetryingClientBuilder<HttpResponse>
- Returns:
this
to support method chaining.- See Also:
-
responseTimeoutForEachAttempt
Description copied from class:AbstractRetryingClientBuilder
Sets the response timeout for each attempt. When requests inAbstractRetryingClient
are made, corresponding responses are timed out by this value.0
disables the timeout.- Overrides:
responseTimeoutForEachAttempt
in classAbstractRetryingClientBuilder<HttpResponse>
- Returns:
this
to support method chaining.- See Also:
-