Record Class RetryPolicy
java.lang.Object
java.lang.Record
com.iantapply.orchestra.api.RetryPolicy
- Record Components:
maxAttempts- total number of attempts, including the firstinitialDelay- delay before the second attemptmultiplier- delay multiplier applied after each failuremaximumDelay- upper bound for an individual delay
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final RetryPolicyDefault policy: three attempts with one-second exponential backoff capped at 30 seconds. -
Constructor Summary
ConstructorsConstructorDescriptionRetryPolicy(int maxAttempts, Duration initialDelay, double multiplier, Duration maximumDelay) Validates retry bounds and delay ordering. -
Method Summary
Modifier and TypeMethodDescriptiondelayBefore(int attempt) Computes the delay before a one-based attempt number.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of theinitialDelayrecord component.intReturns the value of themaxAttemptsrecord component.Returns the value of themaximumDelayrecord component.doubleReturns the value of themultiplierrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
DEFAULT
Default policy: three attempts with one-second exponential backoff capped at 30 seconds.
-
-
Constructor Details
-
RetryPolicy
-
-
Method Details
-
delayBefore
Computes the delay before a one-based attempt number.- Parameters:
attempt- one-based attempt number- Returns:
- zero for the first attempt, otherwise a bounded backoff delay
-
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
-
initialDelay
Returns the value of theinitialDelayrecord component.- Returns:
- the value of the
initialDelayrecord component
-
multiplier
public double multiplier()Returns the value of themultiplierrecord component.- Returns:
- the value of the
multiplierrecord component
-
maximumDelay
Returns the value of themaximumDelayrecord component.- Returns:
- the value of the
maximumDelayrecord component
-