Class RetryExecutor

java.lang.Object
io.confluent.kafka.schemaregistry.client.rest.RetryExecutor

public class RetryExecutor extends Object
  • Constructor Details

    • RetryExecutor

      public RetryExecutor(int maxRetries, int initialWaitMs, int maxWaitMs)
    • RetryExecutor

      public RetryExecutor(int maxRetries, int initialWaitMs, int maxWaitMs, Random random)
    • 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 the Random one for a null literal, which fails to compile rather than reporting a bad argument. Requiring the caller to supply the Random keeps every four-arg call unambiguous.
  • Method Details

    • isRetriable

      public boolean isRetriable(RestClientException e)
      Whether this executor treats the given exception as retriable. Exposed so that callers sharing this executor's retry policy -- notably RestService's URL failover -- make the same decision as retry(Callable) rather than re-deriving it from the default.
    • retry

      public <T> T retry(Callable<T> callable) throws RestClientException, IOException
      Throws:
      RestClientException
      IOException
    • computeDelayBeforeNextRetry

      protected Duration computeDelayBeforeNextRetry(int retriesAttempted)
    • calculateExponentialDelay

      protected int calculateExponentialDelay(int retriesAttempted)