public class ResilientOperation extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
ResilientOperation.CheckedCallable<T,X extends Exception>
Interface that allows a call that can throw an exception X.
|
Constructor and Description |
---|
ResilientOperation() |
Modifier and Type | Method and Description |
---|---|
static <V> ResilientOperation.CheckedCallable<V,IOException> |
getGoogleRequestCallable(com.google.api.client.googleapis.services.AbstractGoogleClientRequest<V> request)
Returns a
ResilientOperation.CheckedCallable that returns encompasses a
AbstractGoogleClientRequest and can be used to retry the execute for a
AbstractGoogleClientReqest. |
static <T,X extends Exception> |
retry(ResilientOperation.CheckedCallable<T,X> 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(ResilientOperation.CheckedCallable<T,X> 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(ResilientOperation.CheckedCallable<T,X> 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
- CheckedCallable 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 Exception
public static <T,X extends Exception> T retry(ResilientOperation.CheckedCallable<T,X> 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
- CheckedCallable 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 Exception
public static <V> ResilientOperation.CheckedCallable<V,IOException> getGoogleRequestCallable(com.google.api.client.googleapis.services.AbstractGoogleClientRequest<V> request)
ResilientOperation.CheckedCallable
that returns encompasses a
AbstractGoogleClientRequest
and can be used to retry the execute for a
AbstractGoogleClientReqest.request
- The AbstractGoogleClientRequest to turn into a ResilientOperation.CheckedCallable
.Copyright © 2016. All rights reserved.