-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
concurrent-api: fix IllegalArgumentExcetion for zero jitter in RetryS…
…trategies (#2777) Motivation: If you pass in a jitter of 0 for the retry strategies with delta delay you'll get an `IllegalArgumentException` thrown by the `Random.nextLong(lower, upper)` method because the lower and upper are the same value. This is because the upper bound argument is non-inclusive. Modifications: Add 1 to each call to extend the range by 1 nanosecond and make the full delay range selectable. We also do this in the case of the `*FullJitter` methods to make the full delay an option instead of being limited to `delay - 1ns`. Result: Less illegal argument exceptions and (technically, although admittedly not practically important) correct delay ranges.
- Loading branch information
1 parent
1d00f69
commit cf40cb3
Showing
2 changed files
with
44 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters