public class RetryPolicy extends Object implements HttpPipelinePolicy
Constructor and Description |
---|
RetryPolicy()
|
RetryPolicy(RetryStrategy retryStrategy)
Creates a
RetryPolicy with the provided RetryStrategy . |
RetryPolicy(RetryStrategy retryStrategy,
String retryAfterHeader,
ChronoUnit retryAfterTimeUnit)
Creates
RetryPolicy with the provided RetryStrategy and default ExponentialBackoff as
RetryStrategy . |
RetryPolicy(String retryAfterHeader,
ChronoUnit retryAfterTimeUnit)
Creates
RetryPolicy using ExponentialBackoff.ExponentialBackoff() as the RetryStrategy
and uses retryAfterHeader to look up the wait period in the returned HttpResponse to calculate
the retry delay when a recoverable HTTP error is returned. |
Modifier and Type | Method and Description |
---|---|
Mono<HttpResponse> |
process(HttpPipelineCallContext context,
HttpPipelineNextPolicy next)
Processes provided request context and invokes the next policy.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getPipelinePosition
public RetryPolicy()
public RetryPolicy(String retryAfterHeader, ChronoUnit retryAfterTimeUnit)
RetryPolicy
using ExponentialBackoff.ExponentialBackoff()
as the RetryStrategy
and uses retryAfterHeader
to look up the wait period in the returned HttpResponse
to calculate
the retry delay when a recoverable HTTP error is returned.retryAfterHeader
- The HTTP header, such as Retry-After
or x-ms-retry-after-ms
, to lookup
for the retry delay. If the value is null, RetryStrategy.calculateRetryDelay(int)
will compute the delay
and ignore the delay provided in response header.retryAfterTimeUnit
- The time unit to use when applying the retry delay. Null is valid if, and only if,
retryAfterHeader
is null.NullPointerException
- When retryAfterTimeUnit
is null and retryAfterHeader
is not null.public RetryPolicy(RetryStrategy retryStrategy, String retryAfterHeader, ChronoUnit retryAfterTimeUnit)
RetryPolicy
with the provided RetryStrategy
and default ExponentialBackoff
as
RetryStrategy
. It will use provided retryAfterHeader
in HttpResponse
headers for
calculating retry delay.retryStrategy
- The RetryStrategy
used for retries.retryAfterHeader
- The HTTP header, such as 'Retry-After' or 'x-ms-retry-after-ms', to lookup for the retry
delay. If the value is null, RetryPolicy
will use the retry strategy to compute the delay and ignore the
delay provided in response header.retryAfterTimeUnit
- The time unit to use when applying the retry delay. null is valid if, and only if,
retryAfterHeader
is null.NullPointerException
- If retryStrategy
is null or when retryAfterTimeUnit
is null and
retryAfterHeader
is not null.public RetryPolicy(RetryStrategy retryStrategy)
RetryPolicy
with the provided RetryStrategy
.retryStrategy
- The RetryStrategy
used for retries.NullPointerException
- If retryStrategy
is null.public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineNextPolicy next)
HttpPipelinePolicy
process
in interface HttpPipelinePolicy
context
- The request context.next
- The next policy to invoke.Copyright © 2021 Microsoft Corporation. All rights reserved.