public class RetryingClientBuilder extends AbstractRetryingClientBuilder<HttpResponse>
RetryingClient or its decorator function.| Modifier and Type | Method and Description |
|---|---|
RetryingClient |
build(HttpClient delegate)
Returns a newly-created
RetryingClient based on the properties of this builder. |
RetryingClientBuilder |
contentPreviewLength(int contentPreviewLength)
Sets the length of content required to determine whether to retry or not.
|
RetryingClientBuilder |
maxTotalAttempts(int maxTotalAttempts)
Sets the maximum number of total attempts.
|
Function<? super HttpClient,RetryingClient> |
newDecorator()
Returns a newly-created decorator that decorates an
HttpClient with a new
RetryingClient based on the properties of this builder. |
RetryingClientBuilder |
responseTimeoutForEachAttempt(Duration responseTimeoutForEachAttempt)
Sets the response timeout for each attempt.
|
RetryingClientBuilder |
responseTimeoutMillisForEachAttempt(long responseTimeoutMillisForEachAttempt)
Sets the response timeout for each attempt in milliseconds.
|
String |
toString() |
RetryingClientBuilder |
useRetryAfter(boolean useRetryAfter)
Whether retry should be attempted according to the
retryHeader from the server or not. |
public RetryingClientBuilder 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 otherwiseRetryingClientBuilder to support method chainingpublic RetryingClientBuilder 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.RetryingClientBuilder 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 RetryingClient build(HttpClient delegate)
RetryingClient based on the properties of this builder.public Function<? super HttpClient,RetryingClient> newDecorator()
HttpClient with a new
RetryingClient based on the properties of this builder.public String toString()
toString in class AbstractRetryingClientBuilder<HttpResponse>public RetryingClientBuilder maxTotalAttempts(int maxTotalAttempts)
AbstractRetryingClientBuilderFlags.defaultMaxTotalAttempts() will be used.maxTotalAttempts in class AbstractRetryingClientBuilder<HttpResponse>this to support method chaining.public RetryingClientBuilder responseTimeoutMillisForEachAttempt(long responseTimeoutMillisForEachAttempt)
AbstractRetryingClientBuilderAbstractRetryingClient 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 AbstractRetryingClientBuilder<HttpResponse>this to support method chaining.public RetryingClientBuilder responseTimeoutForEachAttempt(Duration responseTimeoutForEachAttempt)
AbstractRetryingClientBuilderAbstractRetryingClient are made,
corresponding responses are timed out by this value. 0 disables the timeout.responseTimeoutForEachAttempt in class AbstractRetryingClientBuilder<HttpResponse>this to support method chaining.Copyright © 2020 LeanCloud. All rights reserved.