public class ExceptionHandlers extends Object
ExceptionHandlers.| Modifier and Type | Method and Description |
|---|---|
static ExceptionHandler |
defaultHandler()
The default exception handler.
|
static ExceptionHandler |
exponentialBackoffHandler(int maximumTries,
long initialSleepDuration,
TimeUnit initialSleepUnit)
Create a handler that uses exponential backoff to sleep before retrying.
|
static ExceptionHandler |
noRetryHandler()
Create a handler that always returns
false, causing no retries. |
public static ExceptionHandler defaultHandler()
exponentialBackoffHandler(12, 5, TimeUnit.SECONDS), but it is free to
change in the future.public static ExceptionHandler exponentialBackoffHandler(int maximumTries, long initialSleepDuration, TimeUnit initialSleepUnit)
maximumTries - how many times to try before permanent failureinitialSleepDuration - is countdown on first failureinitialSleepUnit - are the units of countdownpublic static ExceptionHandler noRetryHandler()
false, causing no retries.