Annotation Interface Retry
@Inherited
@Documented
@Retention(RUNTIME)
@Target({METHOD,TYPE})
@InterceptorBinding
public @interface Retry
The Retry annotation to define the number of the retries and the fallback method on reaching the
retry counts. Any invalid config value causes
FaultToleranceDefinitionException
.-
Optional Element Summary
Modifier and TypeOptional ElementDescriptionlong
The delay between retries.long
Set the jitter to randomly vary retry delays for.long
The max duration.int
-
Element Details
-
maxRetries
int maxRetries- Returns:
- The max number of retries. -1 means retry forever. The value must be greater than or equal to -1.
- Default:
- 3
-
delay
long delayThe delay between retries. Defaults to 0. The value must be greater than or equal to 0.- Returns:
- the delay time
- Default:
- 0L
-
delayUnit
ChronoUnit delayUnit- Returns:
- the delay unit
- Default:
- MILLIS
-
maxDuration
long maxDurationThe max duration. The max duration must be greater than the delay duration if set. 0 means not set.- Returns:
- the maximum duration to perform retries for.
- Default:
- 180000L
-
durationUnit
ChronoUnit durationUnit- Returns:
- the duration unit
- Default:
- MILLIS
-
jitter
long jitterSet the jitter to randomly vary retry delays for. The value must be greater than or equals to 0. 0 means not set.
The effective delay will be [delay - jitter, delay + jitter] and always greater than or equal to 0. Negative effective delays will be 0.- Returns:
- the jitter that randomly vary retry delays by. e.g. a jitter of 200 milliseconds will randomly add between -200 and 200 milliseconds to each retry delay.
- Default:
- 200L
-
jitterDelayUnit
ChronoUnit jitterDelayUnit- Returns:
- the jitter delay unit.
- Default:
- MILLIS
-
retryOn
- Returns:
- Specify the failure to retry on. Only a type assignable from
Error
orException
can be specified. Specifying a custom java.lang.Throwable will be ignored.
- Default:
- {java.lang.Exception.class}
-
abortOn
- Returns:
- Specify the failure to abort on. Only a type assignable from
Error
orException
can be specified. Specifying a custom java.lang.Throwable will be ignored.
- Default:
- {}
-