Package com.jcabi.aspects
Annotation Type RetryOnFailure
-
@Documented @Retention(RUNTIME) @Target(METHOD) public @interface RetryOnFailure
Retry the method in case of exception.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(); }
- Since:
- 0.1.10
- See Also:
- http://aspects.jcabi.com/
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element 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 unit.boolean
verbose
Shall it be fully verbose (show full exception trace) or just exception message?
-
-
-
-
unit
TimeUnit unit
Time unit.- Returns:
- Time unit.
- Default:
- java.util.concurrent.TimeUnit.MILLISECONDS
-
-