@Inherited
@Documented
@Retention(value=RUNTIME)
@Target(value={METHOD,TYPE})
public @interface Retry
FaultToleranceDefinitionException
.
When a method returns and the retry policy is present, the following rules are applied:
abortOn()
parameter, the thrown object
is rethrown.
retryOn()
parameter, the method call
is retried.
Throwable
which is not an Error
or Exception
, non-portable behavior
results.maxRetries()
,
delay()
,
delayUnit()
,
maxDuration()
,
durationUnit()
,
jitter()
,
jitterDelayUnit()
,
retryOn()
,
abortOn()
Modifier and Type | Optional Element and Description |
---|---|
java.lang.Class<? extends java.lang.Throwable>[] |
abortOn
The list of exception types that should not trigger a retry.
|
long |
delay
The delay between retries.
|
java.time.temporal.ChronoUnit |
delayUnit
The unit for
delay() . |
java.time.temporal.ChronoUnit |
durationUnit
The duration unit for
maxDuration() . |
long |
jitter
Set the jitter to randomly vary retry delays for.
|
java.time.temporal.ChronoUnit |
jitterDelayUnit
The delay unit for
jitter() . |
long |
maxDuration
The max duration.
|
int |
maxRetries
The max number of the retries.
|
java.lang.Class<? extends java.lang.Throwable>[] |
retryOn
The list of exception types that should trigger a retry.
|
public abstract int maxRetries
public abstract long delay
public abstract java.time.temporal.ChronoUnit delayUnit
delay()
. Defaults to ChronoUnit.MILLIS
if not set.public abstract long maxDuration
public abstract java.time.temporal.ChronoUnit durationUnit
maxDuration()
. Defaults to ChronoUnit.MILLIS
if not set.public abstract long jitter
Set 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.public abstract java.time.temporal.ChronoUnit jitterDelayUnit
jitter()
. Defaults to ChronoUnit.MILLIS
if not set.public abstract java.lang.Class<? extends java.lang.Throwable>[] retryOn
Note that if a method throws a Throwable
which is not an Error
or Exception
, non-portable
behavior results.
public abstract java.lang.Class<? extends java.lang.Throwable>[] abortOn
This list takes priority over the types listed in retryOn()
.
Note that if a method throws a Throwable
which is not an Error
or Exception
, non-portable
behavior results.