Record Class RetryPolicy
java.lang.Object
java.lang.Record
com.cockroachlabs.crdb.retry.RetryPolicy
- Record Components:
maxRetries- maximum retry attempts (in addition to the first try)baseDelayMillis- base backoff delay in millisecondsmaxDelayMillis- upper bound on any single delay in millisecondsmultiplier- exponential growth factor per attempt (>= 1.0)jitter- fraction of the delay applied as random jitter, in [0, 1]
public record RetryPolicy(int maxRetries, long baseDelayMillis, long maxDelayMillis, double multiplier, double jitter)
extends Record
Immutable retry configuration.
-
Constructor Summary
ConstructorsConstructorDescriptionRetryPolicy(int maxRetries, long baseDelayMillis, long maxDelayMillis, double multiplier, double jitter) Creates an instance of aRetryPolicyrecord class. -
Method Summary
Modifier and TypeMethodDescriptionlongReturns the value of thebaseDelayMillisrecord component.static RetryPolicydefaults()Sensible defaults: 5 retries, 100ms base, 5s cap, x2 backoff, 20% jitter.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.doublejitter()Returns the value of thejitterrecord component.longReturns the value of themaxDelayMillisrecord component.intReturns the value of themaxRetriesrecord component.doubleReturns the value of themultiplierrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
RetryPolicy
public RetryPolicy(int maxRetries, long baseDelayMillis, long maxDelayMillis, double multiplier, double jitter) Creates an instance of aRetryPolicyrecord class.- Parameters:
maxRetries- the value for themaxRetriesrecord componentbaseDelayMillis- the value for thebaseDelayMillisrecord componentmaxDelayMillis- the value for themaxDelayMillisrecord componentmultiplier- the value for themultiplierrecord componentjitter- the value for thejitterrecord component
-
-
Method Details
-
defaults
Sensible defaults: 5 retries, 100ms base, 5s cap, x2 backoff, 20% jitter. -
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. All components in this record class are compared with thecomparemethod from their corresponding wrapper classes. -
maxRetries
public int maxRetries()Returns the value of themaxRetriesrecord component.- Returns:
- the value of the
maxRetriesrecord component
-
baseDelayMillis
public long baseDelayMillis()Returns the value of thebaseDelayMillisrecord component.- Returns:
- the value of the
baseDelayMillisrecord component
-
maxDelayMillis
public long maxDelayMillis()Returns the value of themaxDelayMillisrecord component.- Returns:
- the value of the
maxDelayMillisrecord component
-
multiplier
public double multiplier()Returns the value of themultiplierrecord component.- Returns:
- the value of the
multiplierrecord component
-
jitter
-