Skip to content

Commit 36ec1bb

Browse files
feat: ISSUE-228 random - document as Jitter (#376)
* feat: ISSUE-228 random - document as Jitter Signed-off-by: liran2000 <[email protected]> * fix build format Signed-off-by: liran2000 <[email protected]> * Decapitalize jitter. --------- Signed-off-by: liran2000 <[email protected]> Co-authored-by: Gary Russell <[email protected]>
1 parent 99099b9 commit 36ec1bb

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ back off with an exponentially increasing wait period, to avoid two retries gett
337337
lock step and both failing (a lesson learned from Ethernet). For this purpose, Spring
338338
Retry provides `ExponentialBackoffPolicy`. Spring Retry also provides randomized versions
339339
of delay policies that are quite useful to avoid resonating between related failures in a
340-
complex system.
340+
complex system, by adding jitter.
341341

342342
## Listeners
343343

src/main/java/org/springframework/retry/annotation/Backoff.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@
116116

117117
/**
118118
* In the exponential case ({@link #multiplier()} &gt; 0) set this to true to have the
119-
* backoff delays randomized, so that the maximum delay is multiplier times the
120-
* previous delay and the distribution is uniform between the two values.
119+
* backoff delays randomized with jitter, so that the maximum delay is multiplier
120+
* times the previous delay and the distribution is uniform between the two values.
121121
* @return the flag to signal randomization is required (default false)
122122
*/
123123
boolean random() default false;

src/main/java/org/springframework/retry/backoff/ExponentialRandomBackOffPolicy.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
* that chooses a random multiple of the interval that would come from a simple
2727
* deterministic exponential. The random multiple is uniformly distributed between 1 and
2828
* the deterministic multiplier (so in practice the interval is somewhere between the next
29-
* and next but one intervals in the deterministic case).
29+
* and next but one intervals in the deterministic case). This is often referred to as
30+
* jitter.
3031
*
3132
* This has shown to at least be useful in testing scenarios where excessive contention is
3233
* generated by the test needing many retries. In test, usually threads are started at the

0 commit comments

Comments
 (0)