Package com.tuladb

Record Class SmartLedgerClient.RetryPolicy

java.lang.Object
java.lang.Record
com.tuladb.SmartLedgerClient.RetryPolicy
Enclosing class:
SmartLedgerClient

public static record SmartLedgerClient.RetryPolicy(long initialDelayMs, long maxDelayMs, long maxElapsedMs) extends Record
Backoff between retries of one operation, "full jitter": delay(n) is uniform in [0, min(maxDelayMs, initialDelayMs * 2^n)], where n counts the backed-off retries (0 for the first; the one immediate transport / not-leader retry is not counted). No retry is started whose sleep would end more than maxElapsedMs after the first attempt; the last answer is returned instead. How MANY retries is still the client's retryAttempts.
  • Constructor Summary

    Constructors
    Constructor
    Description
    RetryPolicy(long initialDelayMs, long maxDelayMs, long maxElapsedMs)
    Creates an instance of a RetryPolicy record class.
  • Method Summary

    Modifier and Type
    Method
    Description
     
    long
    delayCapMs(int n)
    Upper bound of delayMs(int): min(maxDelayMs, initialDelayMs * 2^n).
    long
    delayMs(int n)
    A jittered delay for retry n: uniform in [0, delayCapMs(int)].
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    long
    Returns the value of the initialDelayMs record component.
    long
    Returns the value of the maxDelayMs record component.
    long
    Returns the value of the maxElapsedMs record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

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

    • RetryPolicy

      public RetryPolicy(long initialDelayMs, long maxDelayMs, long maxElapsedMs)
      Creates an instance of a RetryPolicy record class.
      Parameters:
      initialDelayMs - the value for the initialDelayMs record component
      maxDelayMs - the value for the maxDelayMs record component
      maxElapsedMs - the value for the maxElapsedMs record component
  • Method Details

    • defaults

      public static SmartLedgerClient.RetryPolicy defaults()
    • delayCapMs

      public long delayCapMs(int n)
      Upper bound of delayMs(int): min(maxDelayMs, initialDelayMs * 2^n).
    • delayMs

      public long delayMs(int n)
      A jittered delay for retry n: uniform in [0, delayCapMs(int)].
    • 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 '=='.
      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.
    • initialDelayMs

      public long initialDelayMs()
      Returns the value of the initialDelayMs record component.
      Returns:
      the value of the initialDelayMs record component
    • maxDelayMs

      public long maxDelayMs()
      Returns the value of the maxDelayMs record component.
      Returns:
      the value of the maxDelayMs record component
    • maxElapsedMs

      public long maxElapsedMs()
      Returns the value of the maxElapsedMs record component.
      Returns:
      the value of the maxElapsedMs record component