public final class RetryUtils extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
RetryUtils.RunnableThrowsIOException
Interface for methods which return nothing and may throw IOException.
|
Modifier and Type | Method and Description |
---|---|
static RetryPolicy |
defaultClientRetry()
Gives a default ClientRetry based on config.
|
static RetryPolicy |
defaultWorkerMasterClientRetry() |
static void |
retry(String action,
RetryUtils.RunnableThrowsIOException f,
RetryPolicy policy)
Retries the given method until it doesn't throw an IO exception or the retry policy expires.
|
static <V> V |
retryCallable(String description,
Callable<V> f,
RetryPolicy policy)
Notice we assume the exception with the method is retryable, so we are not wasting time here.
|
public static void retry(String action, RetryUtils.RunnableThrowsIOException f, RetryPolicy policy) throws IOException
action
- a description of the action that fits the phrase "Failed to ${action}"f
- the function to retrypolicy
- the retry policy to useIOException
public static <V> V retryCallable(String description, Callable<V> f, RetryPolicy policy)
V
- result type returned by callabledescription
- a description of the functionf
- the function to retry which returns valuepolicy
- the retry policy to usepublic static RetryPolicy defaultClientRetry()
public static RetryPolicy defaultWorkerMasterClientRetry()
Copyright © 2023. All Rights Reserved.