Class ClaimOptions
java.lang.Object
lol.trq.alts.account.ClaimOptions
How a scheduled name claim paces itself around its target instant.
A final class rather than a record since 1.0.0, so a later setting is an addition and not a break:
start from defaults() or of(Duration, Duration, Duration, int, TimeSource), and derive a copy with withTimeSource(TimeSource). Two options are
equal when every setting is.
- Since:
- 0.11.0
-
Method Summary
Modifier and TypeMethodDescriptionReturns the least gap between two attempts on one worker.intReturns how many attempt chains run in parallel.static ClaimOptionsdefaults()Returns sensible defaults: begin 300 ms early, try for 10 s, 8 ms between a worker's attempts, three chains, system clock.booleanReturns whetheroholds the same settings; the time sources compare by their own equality.inthashCode()Returns a hash over every setting, consistent withequals(Object).leadTime()Returns how far before the target to begin firing, absorbing clock skew and request latency.static ClaimOptionsof(Duration leadTime, Duration window, Duration attemptSpacing, int concurrency, TimeSource timeSource) Creates options with every setting given.Returns the clock the schedule reads, for correcting OS drift.toString()Returns every setting, in the form the record printed them.window()Returns how long to keep trying after the target before giving up.withTimeSource(TimeSource value) Returns a copy reading the given time source.
-
Method Details
-
defaults
Returns sensible defaults: begin 300 ms early, try for 10 s, 8 ms between a worker's attempts, three chains, system clock.- Returns:
- the default options
- Since:
- 0.11.0
-
of
public static ClaimOptions of(Duration leadTime, Duration window, Duration attemptSpacing, int concurrency, TimeSource timeSource) Creates options with every setting given.- Parameters:
leadTime- how far before the target to begin firing; null or negative is zerowindow- how long to keep trying after the target before giving up; null, zero or negative is ten secondsattemptSpacing- the least gap between two attempts on one worker; null or negative is zeroconcurrency- how many attempt chains run in parallel; at least 1timeSource- the clock the schedule reads, or null for the system clock- Returns:
- the options
- Throws:
IllegalArgumentException- ifconcurrencyis below 1- Since:
- 1.0.0
-
leadTime
Returns how far before the target to begin firing, absorbing clock skew and request latency.- Returns:
- the lead time, never negative
- Since:
- 0.11.0
-
window
Returns how long to keep trying after the target before giving up.- Returns:
- the window, always positive
- Since:
- 0.11.0
-
attemptSpacing
Returns the least gap between two attempts on one worker.- Returns:
- the spacing, never negative
- Since:
- 0.11.0
-
concurrency
public int concurrency()Returns how many attempt chains run in parallel.- Returns:
- the concurrency, at least 1
- Since:
- 0.11.0
-
timeSource
Returns the clock the schedule reads, for correcting OS drift.- Returns:
- the time source, never
null - Since:
- 0.11.0
-
withTimeSource
Returns a copy reading the given time source.- Parameters:
value- the time source- Returns:
- a copy with the time source replaced
- Since:
- 0.11.0
-
equals
-
hashCode
public int hashCode()Returns a hash over every setting, consistent withequals(Object). -
toString
-