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 milliseconds
maxDelayMillis - upper bound on any single delay in milliseconds
multiplier - 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

    Constructors
    Constructor
    Description
    RetryPolicy(int maxRetries, long baseDelayMillis, long maxDelayMillis, double multiplier, double jitter)
    Creates an instance of a RetryPolicy record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    Returns the value of the baseDelayMillis record component.
    Sensible defaults: 5 retries, 100ms base, 5s cap, x2 backoff, 20% jitter.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    double
    Returns the value of the jitter record component.
    long
    Returns the value of the maxDelayMillis record component.
    int
    Returns the value of the maxRetries record component.
    double
    Returns the value of the multiplier record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • RetryPolicy

      public RetryPolicy(int maxRetries, long baseDelayMillis, long maxDelayMillis, double multiplier, double jitter)
      Creates an instance of a RetryPolicy record class.
      Parameters:
      maxRetries - the value for the maxRetries record component
      baseDelayMillis - the value for the baseDelayMillis record component
      maxDelayMillis - the value for the maxDelayMillis record component
      multiplier - the value for the multiplier record component
      jitter - the value for the jitter record component
  • Method Details

    • defaults

      public static RetryPolicy defaults()
      Sensible defaults: 5 retries, 100ms base, 5s cap, x2 backoff, 20% jitter.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • maxRetries

      public int maxRetries()
      Returns the value of the maxRetries record component.
      Returns:
      the value of the maxRetries record component
    • baseDelayMillis

      public long baseDelayMillis()
      Returns the value of the baseDelayMillis record component.
      Returns:
      the value of the baseDelayMillis record component
    • maxDelayMillis

      public long maxDelayMillis()
      Returns the value of the maxDelayMillis record component.
      Returns:
      the value of the maxDelayMillis record component
    • multiplier

      public double multiplier()
      Returns the value of the multiplier record component.
      Returns:
      the value of the multiplier record component
    • jitter

      public double jitter()
      Returns the value of the jitter record component.
      Returns:
      the value of the jitter record component