test_class.file: util/src/test/java/com/google/cloud/hadoop/util/ResilientOperationTest.java
test_class.identifier: ResilientOperationTest
test_case.body: @Test
    public void testCallRetriesAndSucceeds() throws Exception {
      MockSleeper sleeper = new MockSleeper();
      ArrayList<Exception> exceptions = new ArrayList<>();
      exceptions.add(new SocketTimeoutException("socket"));
      exceptions.add(new SocketTimeoutException("socket2"));
      exceptions.add(new SocketTimeoutException("socket3"));
      CallableTester<Exception> callTester = new CallableTester<>(exceptions);
      BackOff backoff = new RetryBoundedBackOff(3, new BackOffTester());
      assertThat(
              ResilientOperation.retry(
                  callTester, backoff, RetryDeterminer.DEFAULT, Exception.class, sleeper))
          .isEqualTo(3);
      assertThat(callTester.timesCalled()).isEqualTo(4);
      verifySleeper(sleeper, 3);
    }
test_case.class_method_signature: ResilientOperationTest.testCallRetriesAndSucceeds()
test_case.full_signature: @Test public void testCallRetriesAndSucceeds()
test_case.identifier: testCallRetriesAndSucceeds
test_case.invocations: add add add isEqualTo assertThat retry isEqualTo assertThat timesCalled verifySleeper
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testCallRetriesAndSucceeds()
focal_class.declarator: logger = GoogleLogger.forEnclosingClass()
focal_class.modifier: private static final
focal_class.original_string: private static final GoogleLogger logger = GoogleLogger.forEnclosingClass();
focal_class.type: GoogleLogger
focal_class.var_name: logger
focal_class.file: util/src/main/java/com/google/cloud/hadoop/util/ResilientOperation.java
focal_class.identifier: ResilientOperation
focal_class.class_method_signature: ResilientOperation.retry(
        CheckedCallable<T, X> callable,
        BackOff backoff,
        RetryDeterminer<? super X> retryDet,
        Class<X> classType,
        Sleeper sleeper)
focal_class.full_signature: @SuppressWarnings("unchecked") public static T retry(
        CheckedCallable<T, X> callable,
        BackOff backoff,
        RetryDeterminer<? super X> retryDet,
        Class<X> classType,
        Sleeper sleeper)
focal_class.identifier: retry
focal_class.modifiers: @SuppressWarnings("unchecked") public static
focal_class.parameters: (
        CheckedCallable<T, X> callable,
        BackOff backoff,
        RetryDeterminer<? super X> retryDet,
        Class<X> classType,
        Sleeper sleeper)
focal_class.return: T
focal_class.signature: T retry(
        CheckedCallable<T, X> callable,
        BackOff backoff,
        RetryDeterminer<? super X> retryDet,
        Class<X> classType,
        Sleeper sleeper)
focal_class.class_method_signature: ResilientOperation.retry(
        CheckedCallable<T, X> callable,
        BackOff backoff,
        RetryDeterminer<? super X> retryDet,
        Class<X> classType)
focal_class.full_signature: public static T retry(
        CheckedCallable<T, X> callable,
        BackOff backoff,
        RetryDeterminer<? super X> retryDet,
        Class<X> classType)
focal_class.identifier: retry
focal_class.modifiers: public static
focal_class.parameters: (
        CheckedCallable<T, X> callable,
        BackOff backoff,
        RetryDeterminer<? super X> retryDet,
        Class<X> classType)
focal_class.return: T
focal_class.signature: T retry(
        CheckedCallable<T, X> callable,
        BackOff backoff,
        RetryDeterminer<? super X> retryDet,
        Class<X> classType)
focal_class.class_method_signature: ResilientOperation.nextSleep(BackOff backoff, Sleeper sleeper, Exception currentException)
focal_class.full_signature: private static boolean nextSleep(BackOff backoff, Sleeper sleeper, Exception currentException)
focal_class.identifier: nextSleep
focal_class.modifiers: private static
focal_class.parameters: (BackOff backoff, Sleeper sleeper, Exception currentException)
focal_class.return: boolean
focal_class.signature: boolean nextSleep(BackOff backoff, Sleeper sleeper, Exception currentException)
focal_class.class_method_signature: ResilientOperation.getGoogleRequestCallable(
        AbstractGoogleClientRequest<V> request)
focal_class.full_signature: public static CheckedCallable<V, IOException> getGoogleRequestCallable(
        AbstractGoogleClientRequest<V> request)
focal_class.identifier: getGoogleRequestCallable
focal_class.modifiers: public static
focal_class.parameters: (
        AbstractGoogleClientRequest<V> request)
focal_class.return: CheckedCallable<V, IOException>
focal_class.signature: CheckedCallable<V, IOException> getGoogleRequestCallable(
        AbstractGoogleClientRequest<V> request)
focal_method.body: @SuppressWarnings("unchecked")
    public static <T, X extends Exception> T retry(
        CheckedCallable<T, X> callable,
        BackOff backoff,
        RetryDeterminer<? super X> retryDet,
        Class<X> classType,
        Sleeper sleeper)
        throws X, InterruptedException {
      checkNotNull(backoff, "Must provide a non-null BackOff.");
      checkNotNull(retryDet, "Must provide a non-null RetryDeterminer.");
      checkNotNull(sleeper, "Must provide a non-null Sleeper.");
      checkNotNull(callable, "Must provide a non-null Executable object.");
  
      X currentException;
      do {
        try {
          return callable.call();
        } catch (Exception e) {
          if (classType.isInstance(e)) { // e is something that extends X
            currentException = (X) e;
            if (!retryDet.shouldRetry(currentException)) {
              throw currentException;
            }
          } else {
            if (e instanceof RuntimeException) {
              throw (RuntimeException) e;
            }
            throw new RuntimeException(
                "Retrying with unchecked exceptions that are not RuntimeExceptions is not supported.",
                e);
          }
        }
      } while (nextSleep(backoff, sleeper, currentException));
      throw currentException;
    }
focal_method.class_method_signature: ResilientOperation.retry(
        CheckedCallable<T, X> callable,
        BackOff backoff,
        RetryDeterminer<? super X> retryDet,
        Class<X> classType,
        Sleeper sleeper)
focal_method.full_signature: @SuppressWarnings("unchecked") public static T retry(
        CheckedCallable<T, X> callable,
        BackOff backoff,
        RetryDeterminer<? super X> retryDet,
        Class<X> classType,
        Sleeper sleeper)
focal_method.identifier: retry
focal_method.invocations: checkNotNull checkNotNull checkNotNull checkNotNull call isInstance shouldRetry nextSleep
focal_method.modifiers: @SuppressWarnings("unchecked") public static
focal_method.parameters: (
        CheckedCallable<T, X> callable,
        BackOff backoff,
        RetryDeterminer<? super X> retryDet,
        Class<X> classType,
        Sleeper sleeper)
focal_method.return: T
focal_method.signature: T retry(
        CheckedCallable<T, X> callable,
        BackOff backoff,
        RetryDeterminer<? super X> retryDet,
        Class<X> classType,
        Sleeper sleeper)