public class ResilientOperation extends Object
| Constructor and Description |
|---|
ResilientOperation() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
nextSleep(com.google.api.client.util.BackOff backoff,
com.google.api.client.util.Sleeper sleeper,
Exception currentException)
Determines the amount to sleep for and sleeps if needed.
|
static <T,X extends Exception> |
retry(Callable<T> callable,
com.google.api.client.util.BackOff backoff,
RetryDeterminer<? super X> retryDet,
Class<X> classType)
Retries the given executable function in the case of transient errors defined by the
RetryDeterminer and uses default sleeper.
|
static <T,X extends Exception> |
retry(Callable<T> callable,
com.google.api.client.util.BackOff backoff,
RetryDeterminer<? super X> retryDet,
Class<X> classType,
com.google.api.client.util.Sleeper sleeper)
Retries the given executable function in the case of transient errors defined by the
RetryDeterminer.
|
public static <T,X extends Exception> T retry(Callable<T> callable, com.google.api.client.util.BackOff backoff, RetryDeterminer<? super X> retryDet, Class<X> classType, com.google.api.client.util.Sleeper sleeper) throws X extends Exception, InterruptedException
Does not support unchecked exceptions that are not instances of RuntimeException.
T - Type of object returned by the call.X - Type of exception thrown by the call.callable - Callable to retry execution ofbackoff - BackOff to determine how long to sleep forretryDet - RetryDeterminer to determine when to retryclassType - class type of Xsleeper - Used to sleepX - What is thrown from the executable or the RetryDeterminerInterruptedException - - Exception thrown from sleepX extends Exceptionpublic static <T,X extends Exception> T retry(Callable<T> callable, com.google.api.client.util.BackOff backoff, RetryDeterminer<? super X> retryDet, Class<X> classType) throws X extends Exception, InterruptedException
T - Type of object returned by the call.X - Type of exception thrown by the call.callable - Callable to retry execution ofbackoff - BackOff to determine how long to sleep forretryDet - RetryDeterminer to determine when to retryclassType - class type of XX - What is thrown from the executable or the RetryDeterminerInterruptedException - - Exception thrown from sleepX extends Exceptionpublic static boolean nextSleep(com.google.api.client.util.BackOff backoff,
com.google.api.client.util.Sleeper sleeper,
Exception currentException)
throws InterruptedException
backoff - BackOff to determine how long to sleep forsleeper - Used to sleepcurrentException - exception that caused the retry and sleep. For logging.InterruptedException - if sleep is interruptedCopyright © 2024. All rights reserved.