public T call()

in core/src/main/java/com/google/cloud/sql/core/RetryingCallable.java [64:89]


  public T call() throws Exception {

    for (int attempt = 0; attempt < RETRY_COUNT; attempt++) {
      // Attempt to call the Callable.
      try {
        return callable.call();
      } catch (Exception e) {
        // If this is the last retry attempt, or if the exception is fatal
        // then exit immediately.
        if (attempt == (RETRY_COUNT - 1) || isFatalException(e)) {
          throw e;
        }
        // Else, sleep a random amount of time, then retry
        long sleep = exponentialBackoffMs(attempt);
        try {
          Thread.sleep(sleep);
        } catch (InterruptedException ie) {
          throw e; // if sleep is interrupted, then throw 'e', don't take another iteration
        }
      }
    }

    // If the callable was never called, then throw an exception. This will never happen
    // as long as the preconditions in the constructor are properly met.
    throw new RuntimeException("call was never called.");
  }