@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 Throwable>[] |
ignore
Exception types to ignore.
|
boolean |
randomize
Shall the time between retries by randomized.
|
Class<? extends Throwable>[] |
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 Throwable>[] types
public abstract boolean verbose
public abstract boolean randomize
Copyright © 2012–2017 jcabi.com. All rights reserved.