Class RetryExecutor
java.lang.Object
io.confluent.kafka.schemaregistry.client.rest.RetryExecutor
-
Constructor Summary
ConstructorsConstructorDescriptionRetryExecutor(int maxRetries, int initialWaitMs, int maxWaitMs) RetryExecutor(int maxRetries, int initialWaitMs, int maxWaitMs, Random random) RetryExecutor(int maxRetries, int initialWaitMs, int maxWaitMs, Random random, Predicate<RestClientException> isRetriablePredicate) Deliberately the only constructor accepting a predicate: a four-arg overload taking just a predicate would be ambiguous with theRandomone for anullliteral, which fails to compile rather than reporting a bad argument. -
Method Summary
Modifier and TypeMethodDescriptionprotected intcalculateExponentialDelay(int retriesAttempted) protected DurationcomputeDelayBeforeNextRetry(int retriesAttempted) booleanWhether this executor treats the given exception as retriable.<T> T
-
Constructor Details
-
RetryExecutor
public RetryExecutor(int maxRetries, int initialWaitMs, int maxWaitMs) -
RetryExecutor
-
RetryExecutor
public RetryExecutor(int maxRetries, int initialWaitMs, int maxWaitMs, Random random, Predicate<RestClientException> isRetriablePredicate) Deliberately the only constructor accepting a predicate: a four-arg overload taking just a predicate would be ambiguous with theRandomone for anullliteral, which fails to compile rather than reporting a bad argument. Requiring the caller to supply theRandomkeeps every four-arg call unambiguous.
-
-
Method Details
-
isRetriable
Whether this executor treats the given exception as retriable. Exposed so that callers sharing this executor's retry policy -- notablyRestService's URL failover -- make the same decision asretry(Callable)rather than re-deriving it from the default. -
retry
- Throws:
RestClientExceptionIOException
-
computeDelayBeforeNextRetry
-
calculateExponentialDelay
protected int calculateExponentialDelay(int retriesAttempted)
-