public class RetryUtils extends Object
| Constructor and Description | 
|---|
RetryUtils()  | 
| Modifier and Type | Method and Description | 
|---|---|
static long | 
nextRetrySleepMillis(int nTry)  | 
static <T> T | 
retry(Callable<T> f,
     com.google.common.base.Predicate<Throwable> shouldRetry,
     int maxTries)
Same as  
retry(Callable, Predicate, int, int) with quietTries = 0. | 
static <T> T | 
retry(Callable<T> f,
     com.google.common.base.Predicate<Throwable> shouldRetry,
     int quietTries,
     int maxTries)
Retry an operation using fuzzy exponentially increasing backoff. 
 | 
public static final Logger log
public static <T> T retry(Callable<T> f, com.google.common.base.Predicate<Throwable> shouldRetry, int quietTries, int maxTries) throws Exception
f - the operationshouldRetry - predicate determining whether we should retry after a particular exception thrown by "f"quietTries - first quietTries attempts will log exceptions at DEBUG level rather than WARNmaxTries - maximum number of attemptsException - if maxTries is exhausted, or shouldRetry returns falsepublic static <T> T retry(Callable<T> f, com.google.common.base.Predicate<Throwable> shouldRetry, int maxTries) throws Exception
retry(Callable, Predicate, int, int) with quietTries = 0.Exceptionpublic static long nextRetrySleepMillis(int nTry)
Copyright © 2011–2018. All rights reserved.