Record Class MethodRetrySpec
java.lang.Object
java.lang.Record
org.springframework.resilience.retry.MethodRetrySpec
- Record Components:
includes- applicable exception types to attempt a retry forexcludes- non-applicable exception types to avoid a retry forpredicate- a predicate for filtering exceptions from applicable methodsmaxAttempts- the maximum number of retry attemptsdelay- the base delay after the initial invocationjitter- a jitter value for the next retry attemptmultiplier- a multiplier for a delay for the next retry attemptmaxDelay- the maximum delay for any retry attempt
public record MethodRetrySpec(Collection<Class<? extends Throwable>> includes, Collection<Class<? extends Throwable>> excludes, MethodRetryPredicate predicate, long maxAttempts, Duration delay, Duration jitter, double multiplier, Duration maxDelay)
extends Record
A specification for retry attempts on a given method, combining common
retry characteristics. This roughly matches the annotation attributes
on
Retryable.- Since:
- 7.0
- Author:
- Juergen Hoeller
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionMethodRetrySpec(Collection<Class<? extends Throwable>> includes, Collection<Class<? extends Throwable>> excludes, MethodRetryPredicate predicate, long maxAttempts, Duration delay, Duration jitter, double multiplier, Duration maxDelay) Creates an instance of aMethodRetrySpecrecord class.MethodRetrySpec(MethodRetryPredicate predicate, long maxAttempts, Duration delay) MethodRetrySpec(MethodRetryPredicate predicate, long maxAttempts, Duration delay, Duration jitter, double multiplier, Duration maxDelay) -
Method Summary
Modifier and TypeMethodDescriptiondelay()Returns the value of thedelayrecord component.final booleanIndicates whether some other object is "equal to" this one.Collection<Class<? extends Throwable>> excludes()Returns the value of theexcludesrecord component.final inthashCode()Returns a hash code value for this object.Collection<Class<? extends Throwable>> includes()Returns the value of theincludesrecord component.jitter()Returns the value of thejitterrecord component.longReturns the value of themaxAttemptsrecord component.maxDelay()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.
-
Constructor Details
-
MethodRetrySpec
-
MethodRetrySpec
public MethodRetrySpec(MethodRetryPredicate predicate, long maxAttempts, Duration delay, Duration jitter, double multiplier, Duration maxDelay) -
MethodRetrySpec
public MethodRetrySpec(Collection<Class<? extends Throwable>> includes, Collection<Class<? extends Throwable>> excludes, MethodRetryPredicate predicate, long maxAttempts, Duration delay, Duration jitter, double multiplier, Duration maxDelay) Creates an instance of aMethodRetrySpecrecord class.- Parameters:
includes- the value for theincludesrecord componentexcludes- the value for theexcludesrecord componentpredicate- the value for thepredicaterecord componentmaxAttempts- the value for themaxAttemptsrecord componentdelay- the value for thedelayrecord componentjitter- the value for thejitterrecord componentmultiplier- the value for themultiplierrecord componentmaxDelay- the value for themaxDelayrecord component
-
-
Method Details
-
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. -
includes
-
excludes
-
predicate
-
maxAttempts
public long maxAttempts()Returns the value of themaxAttemptsrecord component.- Returns:
- the value of the
maxAttemptsrecord component
-
delay
-
jitter
-
multiplier
public double multiplier()Returns the value of themultiplierrecord component.- Returns:
- the value of the
multiplierrecord component
-
maxDelay
-