Package com.couchbase.client.core.retry
Class FailFastRetryStrategy
- java.lang.Object
-
- com.couchbase.client.core.retry.FailFastRetryStrategy
-
- All Implemented Interfaces:
RetryStrategy
@Internal public class FailFastRetryStrategy extends Object implements RetryStrategy
An internal strategy to fail fast any request that goes through it.This class is considered internal! For external purposes we recommend extending the
BestEffortRetryStrategy
and only failing on certainRetryReason
as needed or based on a request context or external property. Using this strategy here directly, if not used carefully, will lead to lot of copy/pasting of try/catch blocks and not to clean code.
-
-
Field Summary
Fields Modifier and Type Field Description static FailFastRetryStrategy
INSTANCE
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CompletableFuture<RetryAction>
shouldRetry(Request<? extends Response> request, RetryReason reason)
Checks if the given request should be retried and how long the retry delay should be.String
toString()
-
-
-
Field Detail
-
INSTANCE
public static final FailFastRetryStrategy INSTANCE
-
-
Method Detail
-
shouldRetry
public CompletableFuture<RetryAction> shouldRetry(Request<? extends Response> request, RetryReason reason)
Description copied from interface:RetryStrategy
Checks if the given request should be retried and how long the retry delay should be.- Specified by:
shouldRetry
in interfaceRetryStrategy
- Parameters:
request
- the request to be checked.- Returns:
- If empty, no retry should be done. If a duration is returned it determines the retry delay.
-
-