@Documented @Retention(value=RUNTIME) @Target(value=METHOD) public @interface RetryOnFailure
For example, this load()
method will retry to load the URL
content if it fails at the first attempts:
@RetryOnFailure(attempts = 2) String load(URL url) throws IOException { return url.getContent().toString(); }
Modifier and Type | Optional Element and Description |
---|---|
int |
attempts
How many times to retry.
|
long |
delay
Delay between attempts, in time units.
|
Class<? extends Exception>[] |
types
When to retry (in case of what exception types).
|
TimeUnit |
unit
Time units.
|
boolean |
verbose
Shall it be fully verbose (show full exception trace) or just
exception message?
|
public abstract int attempts
public abstract long delay
public abstract TimeUnit unit
public abstract Class<? extends Exception>[] types
public abstract boolean verbose
Copyright © 2012-2013 jcabi.com. All Rights Reserved.