Class RetryPolicy
- java.lang.Object
-
- fish.payara.microprofile.faulttolerance.policy.Policy
-
- fish.payara.microprofile.faulttolerance.policy.RetryPolicy
-
- All Implemented Interfaces:
Serializable
public final class RetryPolicy extends Policy
The resolved "cached" information of aRetryannotation an a specific method.- Author:
- Jan Bernitt
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description Class<? extends Throwable>[]abortOnlongdelayChronoUnitdelayUnitChronoUnitdurationUnitlongjitterChronoUnitjitterDelayUnitlongmaxDurationintmaxRetriesClass<? extends Throwable>[]retryOn
-
Constructor Summary
Constructors Constructor 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)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static RetryPolicycreate(jakarta.interceptor.InvocationContext context, FaultToleranceConfig config)booleanisDelayed()booleanisMaxDurationSet()booleanisMaxRetriesSet()booleanisNone()longjitteredDelay()booleanretryOn(Throwable ex)Should a retry occur then the givenThrowableis thrown? Relevant section fromRetryjavadocs: 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.LongtimeoutTimeNow()inttotalAttempts()-
Methods inherited from class fish.payara.microprofile.faulttolerance.policy.Policy
checkAtLeast, checkAtLeast, checkAtLeast, checkAtMost, checkReturnsSameAs, checkReturnsSameAs, describe, isCaught
-
-
-
-
Field Detail
-
maxRetries
public final int maxRetries
-
delay
public final long delay
-
delayUnit
public final ChronoUnit delayUnit
-
maxDuration
public final long maxDuration
-
durationUnit
public final ChronoUnit durationUnit
-
jitter
public final long jitter
-
jitterDelayUnit
public final ChronoUnit jitterDelayUnit
-
-
Constructor Detail
-
RetryPolicy
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)
-
-
Method Detail
-
create
public static RetryPolicy create(jakarta.interceptor.InvocationContext context, FaultToleranceConfig config)
-
isNone
public boolean isNone()
-
retryOn
public boolean retryOn(Throwable ex)
Should a retry occur then the givenThrowableis thrown? Relevant section fromRetryjavadocs: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.
-
timeoutTimeNow
public Long timeoutTimeNow()
-
isDelayed
public boolean isDelayed()
-
jitteredDelay
public long jitteredDelay()
-
totalAttempts
public int totalAttempts()
-
isMaxRetriesSet
public boolean isMaxRetriesSet()
-
isMaxDurationSet
public boolean isMaxDurationSet()
-
-