public final class RetryingHttpClientBuilder extends RetryingClientBuilder<HttpResponse>
RetryingHttpClient or its decorator function.| Constructor and Description |
|---|
RetryingHttpClientBuilder(RetryStrategy retryStrategy)
Deprecated.
|
RetryingHttpClientBuilder(RetryStrategyWithContent<HttpResponse> retryStrategyWithContent)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
RetryingHttpClient |
build(HttpClient delegate)
Returns a newly-created
RetryingHttpClient based on the properties of this builder. |
RetryingHttpClientBuilder |
contentPreviewLength(int contentPreviewLength)
Sets the length of content required to determine whether to retry or not.
|
RetryingHttpClientBuilder |
maxTotalAttempts(int maxTotalAttempts)
Sets the maximum number of total attempts.
|
Function<? super HttpClient,RetryingHttpClient> |
newDecorator()
Returns a newly-created decorator that decorates an
HttpClient with a new
RetryingHttpClient based on the properties of this builder. |
RetryingHttpClientBuilder |
responseTimeoutForEachAttempt(Duration responseTimeoutForEachAttempt)
Sets the response timeout for each attempt.
|
RetryingHttpClientBuilder |
responseTimeoutMillisForEachAttempt(long responseTimeoutMillisForEachAttempt)
Sets the response timeout for each attempt in milliseconds.
|
String |
toString() |
RetryingHttpClientBuilder |
useRetryAfter(boolean useRetryAfter)
Whether retry should be attempted according to the
retryHeader from the server or not. |
@Deprecated public RetryingHttpClientBuilder(RetryStrategy retryStrategy)
RetryingHttpClient.builder(RetryStrategy).RetryStrategy.@Deprecated public RetryingHttpClientBuilder(RetryStrategyWithContent<HttpResponse> retryStrategyWithContent)
RetryingHttpClient.builder(RetryStrategyWithContent).RetryStrategyWithContent.public RetryingHttpClientBuilder useRetryAfter(boolean useRetryAfter)
retryHeader from the server or not.
The web server may request a client to retry after specific time with retryAfter header.
If you want to follow the direction from the server not by your Backoff, invoke this method
with the useRetryAfter with true to request after the specified delay.useRetryAfter - true if you want to retry after using the retryAfter header.
false otherwiseRetryingHttpClientBuilder to support method chainingpublic RetryingHttpClientBuilder contentPreviewLength(int contentPreviewLength)
RetryStrategyWithContent when calling
this builder's constructor. The default value of this property is
.contentPreviewLength - the content length to preview. 0 does not disable the length limit.RetryingHttpClientBuilder to support method chainingIllegalStateException - if this builder is created with a RetryStrategy rather than
RetryStrategyWithContentIllegalArgumentException - if the specified contentPreviewLength is equal to or
less than 0public RetryingHttpClient build(HttpClient delegate)
RetryingHttpClient based on the properties of this builder.public Function<? super HttpClient,RetryingHttpClient> newDecorator()
HttpClient with a new
RetryingHttpClient based on the properties of this builder.public String toString()
toString in class RetryingClientBuilder<HttpResponse>public RetryingHttpClientBuilder maxTotalAttempts(int maxTotalAttempts)
RetryingClientBuilderFlags.defaultMaxTotalAttempts() will be used.maxTotalAttempts in class RetryingClientBuilder<HttpResponse>this to support method chaining.public RetryingHttpClientBuilder responseTimeoutMillisForEachAttempt(long responseTimeoutMillisForEachAttempt)
RetryingClientBuilderRetryingClient are made,
corresponding responses are timed out by this value. 0 disables the timeout.
It will be set by the default value in Flags.defaultResponseTimeoutMillis(), if the client
dose not specify.responseTimeoutMillisForEachAttempt in class RetryingClientBuilder<HttpResponse>this to support method chaining.public RetryingHttpClientBuilder responseTimeoutForEachAttempt(Duration responseTimeoutForEachAttempt)
RetryingClientBuilderRetryingClient are made,
corresponding responses are timed out by this value. 0 disables the timeout.responseTimeoutForEachAttempt in class RetryingClientBuilder<HttpResponse>this to support method chaining.Copyright © 2020 LeanCloud. All rights reserved.