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 aMethodRetrySpec
record 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 thedelay
record component.final boolean
Indicates whether some other object is "equal to" this one.Collection
<Class<? extends Throwable>> excludes()
Returns the value of theexcludes
record component.final int
hashCode()
Returns a hash code value for this object.Collection
<Class<? extends Throwable>> includes()
Returns the value of theincludes
record component.jitter()
Returns the value of thejitter
record component.long
Returns the value of themaxAttempts
record component.maxDelay()
Returns the value of themaxDelay
record component.double
Returns the value of themultiplier
record component.Returns the value of thepredicate
record component.final String
toString()
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 aMethodRetrySpec
record class.- Parameters:
includes
- the value for theincludes
record componentexcludes
- the value for theexcludes
record componentpredicate
- the value for thepredicate
record componentmaxAttempts
- the value for themaxAttempts
record componentdelay
- the value for thedelay
record componentjitter
- the value for thejitter
record componentmultiplier
- the value for themultiplier
record componentmaxDelay
- the value for themaxDelay
record 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 thecompare
method from their corresponding wrapper classes. -
includes
-
excludes
-
predicate
-
maxAttempts
public long maxAttempts()Returns the value of themaxAttempts
record component.- Returns:
- the value of the
maxAttempts
record component
-
delay
-
jitter
-
multiplier
public double multiplier()Returns the value of themultiplier
record component.- Returns:
- the value of the
multiplier
record component
-
maxDelay
-