Package com.couchbase.client.core.retry
Class RetryAction
java.lang.Object
com.couchbase.client.core.retry.RetryAction
The
RetryAction
describes how and when a request should be retried.-
Method Summary
Modifier and TypeMethodDescriptionduration()
If present, the operation should be retried after the given duration.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 newRetryAction
indicating that the request should not be retried.static RetryAction
Constructs a newRetryAction
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 newRetryAction
indicating that the request should be retried after the given duration.
-
Method Details
-
withDuration
Constructs a newRetryAction
indicating that the request should be retried after the given duration.- Parameters:
duration
- the duration after which the request should be retried.- Returns:
- a new
RetryAction
indicating retry.
-
noRetry
Constructs a newRetryAction
indicating that the request should not be retried.- Returns:
- a new
RetryAction
indicating no retry.
-
noRetry
Constructs a newRetryAction
indicating that the request should not be retried, and a specific exception should be used to fail the request.- Parameters:
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.- Returns:
- a new
RetryAction
indicating no retry and a custom exception.
-
duration
If present, the operation should be retried after the given duration.- Returns:
- the duration indicating if (and when) the request should be retried.
-
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.
-