public class RetryManager
extends java.lang.Object
| Constructor and Description |
|---|
RetryManager(BackoffStrategy strategy,
int maxAttempts,
com.codahale.metrics.Timer attempts,
com.codahale.metrics.Meter attemptFailures) |
| Modifier and Type | Method and Description |
|---|---|
protected <T> T |
finalAttemptFailed(Retryable<T> operation,
int attempt,
java.lang.Throwable e)
Called when the final attempt at a retryable operation failed
Allows extending classes to customise behaviour or throw custom exceptions
|
protected boolean |
maxAttemptsReached(int attempt)
Returns true if the given attempt number is greater than or equal to the maximum number of attempts this retry manager
should
run
|
<T> T |
run(Retryable<T> operation) |
<T> T |
runUnchecked(Retryable<T> operation)
Run the operation, only throwing an unchecked exception on failure
|
public RetryManager(BackoffStrategy strategy, int maxAttempts, com.codahale.metrics.Timer attempts, com.codahale.metrics.Meter attemptFailures)
public <T> T run(Retryable<T> operation) throws java.lang.Exception
java.lang.Exceptionprotected boolean maxAttemptsReached(int attempt)
attempt - protected <T> T finalAttemptFailed(Retryable<T> operation, int attempt, java.lang.Throwable e) throws java.lang.Exception
operation - - the operation being attemptedattempt - - the attempt number that failede - - the exception thrown when the operation failedjava.lang.Exceptionpublic <T> T runUnchecked(Retryable<T> operation) throws java.lang.RuntimeException
T - operation - java.lang.RuntimeExceptionCopyright © 2014. All Rights Reserved.