public class RetryAction extends Object
RetryAction describes how and when a request should be retried.| Modifier and Type | Method and Description |
|---|---|
Optional<Duration> |
duration()
If present, the operation should be retried after the given duration.
|
Function<Throwable,Throwable> |
exceptionTranslator()
If a request is cancelled as the result of this retry action, the
throwable used to fail the request should be translated by this function.
|
static RetryAction |
noRetry()
Constructs a new
RetryAction indicating that the request should not be retried. |
static RetryAction |
noRetry(Function<Throwable,Throwable> exceptionTranslator)
Constructs a new
RetryAction indicating that the request should not be retried,
and a specific exception should be used to fail the request. |
static RetryAction |
withDuration(Duration duration)
Constructs a new
RetryAction indicating that the request should be retried after the given duration. |
public static RetryAction withDuration(Duration duration)
RetryAction indicating that the request should be retried after the given duration.duration - the duration after which the request should be retried.RetryAction indicating retry.public static RetryAction noRetry()
RetryAction indicating that the request should not be retried.RetryAction indicating no retry.@Stability.Volatile public static RetryAction noRetry(Function<Throwable,Throwable> exceptionTranslator)
RetryAction indicating that the request should not be retried,
and a specific exception should be used to fail the request.exceptionTranslator - customizes the exception used to fail the request.
If the translator creates a new exception, to preserve the error context it should
use the function argument as the new exception's cause.RetryAction indicating no retry and a custom exception.public Optional<Duration> duration()
Copyright © 2024 Couchbase, Inc.. All rights reserved.