code: <T> T callWithRetries(Callable<T> callable, RecurringPolicy<?> recurringPolicy,
        RecurringStats retryStats, Set<Class<? extends Exception>> retryableExceptions,
        boolean recoverable, boolean logFailures) throws Exception {
      boolean recovery = retryStats != null;
  
      while (true) {
        try {
          return callable.call();
        } catch (Exception e) {
          ShutdownSignalException sse = extractCause(e, ShutdownSignalException.class);
          if (sse == null && logFailures && recurringPolicy != null
              && recurringPolicy.allowsAttempts())
            log.error("Invocation of {} failed.", callable, e);
  
          if (sse != null && (recovery || !recoverable))
            throw e;
  
          if (!closed) {
            try {
              // Retry on channel recovery failure or retryable exception
              boolean retryable =
                  recurringPolicy != null && recurringPolicy.allowsAttempts()
                      && isRetryable(retryableExceptions, e, sse);
              long startTime = System.nanoTime();
  
              if (retryable) {
                if (retryStats == null) 
                  retryStats = new RecurringStats(recurringPolicy);
                  
                // Wait for pending recovery
                if (sse != null) {
                  if (recurringPolicy.getMaxDuration() == null)
                    circuit.await();
                  else if (!circuit.await(retryStats.getMaxWaitTime())) {
                    log.debug("Exceeded max wait time while waiting for {} to recover", this);
                    throw e;
                  }
                }
  
                // Continue retries
                retryStats.incrementAttempts();
                if (!retryStats.isPolicyExceeded()) {
                  long remainingWaitTime =
                      retryStats.getWaitTime().toNanos() - (System.nanoTime() - startTime);
                  if (remainingWaitTime > 0)
                    retryWaiter.await(Duration.nanos(remainingWaitTime));
                  continue;
                }
              }
            } catch (Throwable ignore) {
            }
          }
  
          throw e;
        }
      }
    }
docs: Calls the {@code callable} with retries, throwing a failure if retries are exhausted.