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
ConstructorsConstructorDescriptionRetryPolicy(long initialDelayMs, long maxDelayMs, long maxElapsedMs) Creates an instance of aRetryPolicyrecord class. -
Method Summary
Modifier and TypeMethodDescriptiondefaults()longdelayCapMs(int n) Upper bound ofdelayMs(int): min(maxDelayMs, initialDelayMs * 2^n).longdelayMs(int n) A jittered delay for retryn: uniform in [0,delayCapMs(int)].final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.longReturns the value of theinitialDelayMsrecord component.longReturns the value of themaxDelayMsrecord component.longReturns the value of themaxElapsedMsrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
RetryPolicy
public RetryPolicy(long initialDelayMs, long maxDelayMs, long maxElapsedMs) Creates an instance of aRetryPolicyrecord class.- Parameters:
initialDelayMs- the value for theinitialDelayMsrecord componentmaxDelayMs- the value for themaxDelayMsrecord componentmaxElapsedMs- the value for themaxElapsedMsrecord component
-
-
Method Details
-
defaults
-
delayCapMs
public long delayCapMs(int n) Upper bound ofdelayMs(int): min(maxDelayMs, initialDelayMs * 2^n). -
delayMs
public long delayMs(int n) A jittered delay for retryn: uniform in [0,delayCapMs(int)]. -
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. -
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. -
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 '=='. -
initialDelayMs
public long initialDelayMs()Returns the value of theinitialDelayMsrecord component.- Returns:
- the value of the
initialDelayMsrecord component
-
maxDelayMs
public long maxDelayMs()Returns the value of themaxDelayMsrecord component.- Returns:
- the value of the
maxDelayMsrecord component
-
maxElapsedMs
public long maxElapsedMs()Returns the value of themaxElapsedMsrecord component.- Returns:
- the value of the
maxElapsedMsrecord component
-