public final class RetryPolicy extends Policy
Retry
annotation an a specific method.Modifier and Type | Field and Description |
---|---|
Class<? extends Throwable>[] |
abortOn |
long |
delay |
ChronoUnit |
delayUnit |
ChronoUnit |
durationUnit |
long |
jitter |
ChronoUnit |
jitterDelayUnit |
long |
maxDuration |
int |
maxRetries |
Class<? extends Throwable>[] |
retryOn |
Constructor and Description |
---|
RetryPolicy(Method annotatedMethod,
int maxRetries,
long delay,
ChronoUnit delayUnit,
long maxDuration,
ChronoUnit durationUnit,
long jitter,
ChronoUnit jitterDelayUnit,
Class<? extends Throwable>[] retryOn,
Class<? extends Throwable>[] abortOn) |
Modifier and Type | Method and Description |
---|---|
static RetryPolicy |
create(javax.interceptor.InvocationContext context,
FaultToleranceConfig config) |
boolean |
isDelayed() |
boolean |
isNone() |
long |
jitteredDelay() |
boolean |
retryOn(Throwable ex)
Should a retry occur then the given
Throwable is thrown?
Relevant section from Retry javadocs:
When a method returns and the retry policy is present, the following rules are applied:
If the method returns normally (doesn't throw), the result is simply returned. |
Long |
timeoutTimeNow() |
int |
totalAttempts() |
checkAtLeast, checkAtLeast, checkAtLeast, checkAtMost, checkReturnsSameAs, checkReturnsSameAs, describe, isCaught
public final int maxRetries
public final long delay
public final ChronoUnit delayUnit
public final long maxDuration
public final ChronoUnit durationUnit
public final long jitter
public final ChronoUnit jitterDelayUnit
public RetryPolicy(Method annotatedMethod, int maxRetries, long delay, ChronoUnit delayUnit, long maxDuration, ChronoUnit durationUnit, long jitter, ChronoUnit jitterDelayUnit, Class<? extends Throwable>[] retryOn, Class<? extends Throwable>[] abortOn)
public static RetryPolicy create(javax.interceptor.InvocationContext context, FaultToleranceConfig config)
public boolean isNone()
public boolean retryOn(Throwable ex)
Throwable
is thrown?
Relevant section from Retry
javadocs:
When a method returns and the retry policy is present, the following rules are applied:
- If the method returns normally (doesn't throw), the result is simply returned.
- Otherwise, if the thrown object is assignable to any value in the
#abortOn()
parameter, the thrown object is rethrown.- Otherwise, if the thrown object is assignable to any value in the
#retryOn()
parameter, the method call is retried.- Otherwise the thrown object is rethrown.
public Long timeoutTimeNow()
public boolean isDelayed()
public long jitteredDelay()
public int totalAttempts()
Copyright © 2020. All rights reserved.