Package com.couchbase.client.core.retry
Class RetryOrchestrator
java.lang.Object
com.couchbase.client.core.retry.RetryOrchestrator
@Internal public class RetryOrchestrator extends Object
The
RetryOrchestrator
is responsible for checking if a request is eligible for retry
and if so dispatch it properly and update state.
This class has been around since the 1.0 days, but has been adapted to fit the new model where each request can have its own retry strategy.
- Since:
- 1.0.0
-
Constructor Summary
Constructors Constructor Description RetryOrchestrator()
-
Method Summary
Modifier and Type Method Description static Duration
capDuration(Duration uncappedDuration, Request<? extends Response> request)
Calculates the potentially capped retry duration so we do not schedule a longer retry than the actual total timeout.static void
maybeRetry(CoreContext ctx, Request<? extends Response> request, RetryReason reason)
Retry or cancel the given request, depending on its state and the configuredRetryStrategy
.
-
Constructor Details
-
RetryOrchestrator
public RetryOrchestrator()
-
-
Method Details
-
maybeRetry
public static void maybeRetry(CoreContext ctx, Request<? extends Response> request, RetryReason reason)Retry or cancel the given request, depending on its state and the configuredRetryStrategy
.- Parameters:
ctx
- the core context into which timer the request is submitted.request
- the request in question.reason
- the reason why the request is being retried.
-
capDuration
@Internal public static Duration capDuration(Duration uncappedDuration, Request<? extends Response> request)Calculates the potentially capped retry duration so we do not schedule a longer retry than the actual total timeout.- Parameters:
uncappedDuration
- the uncapped proposed duration.request
- the request information.- Returns:
- the capped duration if needed, otherwise the uncapped duration.
-