E - the type of error code or exception that occurs when the
operation fails.public class Retryer<E> extends Object
| Constructor and Description |
|---|
Retryer(int retries)
Constructs a retryer with a number of retries.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
execute(Retryable<E> operation)
Executes a command with
retries retries. |
int |
getAttempts()
Gets the number of attempts that have been made to execute the
Retryable from the most recent call to
execute(org.arp.javautil.io.Retryable). |
List<E> |
getErrors()
Returns any error codes or exceptions from the most recent call to
execute(org.arp.javautil.io.Retryable). |
int |
getRetries()
Gets the number of times that
execute(org.arp.javautil.io.Retryable) will retry the
operation. |
public Retryer(int retries)
retries - the number of retries.public int getRetries()
execute(org.arp.javautil.io.Retryable) will retry the
operation.public int getAttempts()
Retryable from the most recent call to
execute(org.arp.javautil.io.Retryable).public List<E> getErrors()
execute(org.arp.javautil.io.Retryable). The number of codes is
equal to the number of failures, and the codes are returned in
order.List of errors.public boolean execute(Retryable<E> operation)
retries retries. This can be
executed multiple times.operation - the operation to attempt.true if the operation succeeded, false
if not. Consult getErrors() for any error codes or exceptions
that the operation returned.Copyright © 2012–2018 Emory University. All rights reserved.