Record Class RetryPolicy
java.lang.Object
java.lang.Record
io.micronaut.retry.RetryPolicy
- Record Components:
maxAttempts- The maximum number of attemptsdelay- The delay between retry attemptsmaxDelay- The maximum overall delaymultiplier- The delay multiplierjitter- The retry jitter factorpredicate- The retry predicatecapturedException- The captured exception typeincludes- The included exception typesexcludes- The excluded exception types
public record RetryPolicy(int maxAttempts, Duration delay, @Nullable Duration maxDelay, double multiplier, double jitter, RetryPredicate predicate, Class<? extends Throwable> capturedException, List<Class<? extends Throwable>> includes, List<Class<? extends Throwable>> excludes)
extends Record
Typed retry policy for programmatic retry execution.
- Since:
- 5.0.0
- Author:
- graemerocher
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Durationstatic final doublestatic final intstatic final double -
Constructor Summary
ConstructorsConstructorDescriptionRetryPolicy(int maxAttempts, Duration delay, @Nullable Duration maxDelay, double multiplier, double jitter, RetryPredicate predicate, Class<? extends Throwable> capturedException, List<Class<? extends Throwable>> includes, List<Class<? extends Throwable>> excludes) Creates an instance of aRetryPolicyrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic RetryPolicy.Builderbuilder()Creates a retry policy builder.Returns the value of thecapturedExceptionrecord component.delay()Returns the value of thedelayrecord component.final booleanIndicates whether some other object is "equal to" this one.excludes()Returns the value of theexcludesrecord component.Returns the maximum overall delay.final inthashCode()Returns a hash code value for this object.includes()Returns the value of theincludesrecord component.doublejitter()Returns the value of thejitterrecord component.intReturns the value of themaxAttemptsrecord component.@Nullable DurationmaxDelay()Returns the value of themaxDelayrecord component.doubleReturns the value of themultiplierrecord component.Returns the value of thepredicaterecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
DEFAULT_MAX_ATTEMPTS
public static final int DEFAULT_MAX_ATTEMPTS- See Also:
-
DEFAULT_DELAY
-
DEFAULT_MULTIPLIER
public static final double DEFAULT_MULTIPLIER- See Also:
-
DEFAULT_JITTER
public static final double DEFAULT_JITTER- See Also:
-
DEFAULT_CAPTURED_EXCEPTION
-
-
Constructor Details
-
RetryPolicy
public RetryPolicy(int maxAttempts, Duration delay, @Nullable Duration maxDelay, double multiplier, double jitter, RetryPredicate predicate, Class<? extends Throwable> capturedException, List<Class<? extends Throwable>> includes, List<Class<? extends Throwable>> excludes) Creates an instance of aRetryPolicyrecord class.- Parameters:
maxAttempts- the value for themaxAttemptsrecord componentdelay- the value for thedelayrecord componentmaxDelay- the value for themaxDelayrecord componentmultiplier- the value for themultiplierrecord componentjitter- the value for thejitterrecord componentpredicate- the value for thepredicaterecord componentcapturedException- the value for thecapturedExceptionrecord componentincludes- the value for theincludesrecord componentexcludes- the value for theexcludesrecord component
-
-
Method Details
-
builder
Creates a retry policy builder.- Returns:
- A retry policy builder
-
getMaxDelay
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
maxAttempts
public int maxAttempts()Returns the value of themaxAttemptsrecord component.- Returns:
- the value of the
maxAttemptsrecord component
-
delay
-
maxDelay
-
multiplier
public double multiplier()Returns the value of themultiplierrecord component.- Returns:
- the value of the
multiplierrecord component
-
jitter
-
predicate
-
capturedException
Returns the value of thecapturedExceptionrecord component.- Returns:
- the value of the
capturedExceptionrecord component
-
includes
-
excludes
-