public class DefaultRetrier extends Object implements Retrier
UnresolvedConflictException.
Construct it with the number of times a Callable should be attempted.
When attempt is called with a Callable then
Callable.call() is run attempts times before throwing a
RiakRetryFailedException. It is important to note that there is no
backoff between attempts.
| Constructor and Description |
|---|
DefaultRetrier(int attempts) |
| Modifier and Type | Method and Description |
|---|---|
<T> T |
attempt(Callable<T> command)
Called by
RiakOperation execute methods to give some measure of fault tolerance. |
static <T> T |
attempt(Callable<T> command,
int times)
Calls
Callable.call() times before giving up and
throwing a RiakRetryFailedException There is no back off. |
static Retrier |
attempts(int attempts)
Static factory method to create a default retrier
|
public DefaultRetrier(int attempts)
attempts - how many times the retrier should attempt the call before
throwing a RiakRetryFailedExceptionpublic <T> T attempt(Callable<T> command) throws RiakRetryFailedException
RetrierRiakOperation execute methods to give some measure of fault tolerance.attempt in interface RetrierT - the Type the Callable.call() returnscommand - the CallableCallable.call()RiakRetryFailedException - if the retrier exceeds its bounds.public static <T> T attempt(Callable<T> command, int times) throws RiakRetryFailedException
Callable.call() times before giving up and
throwing a RiakRetryFailedException There is no back off.T - the Callable's return type.command - the Callable to attempttimes - how many times to try before we throwRiakRetryFailedException - if the Callable throws an exception times timespublic static Retrier attempts(int attempts)
attempts - how many times the DefaultRetrier will attempt to call
a Callable supplied to
Retrier.attempt(Callable)DefaultRetrier configured for attempts
retriesCopyright © 2014. All Rights Reserved.