From 9b66afc9f43736de49ba5ef5a3c218d6124a007b Mon Sep 17 00:00:00 2001 From: liran2000 Date: Sun, 20 Aug 2023 16:05:41 +0300 Subject: [PATCH 1/3] feat: ISSUE-228 random - document as Jitter Signed-off-by: liran2000 --- README.md | 2 +- src/main/java/org/springframework/retry/annotation/Backoff.java | 2 +- .../retry/backoff/ExponentialRandomBackOffPolicy.java | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f4ef8762..d82de812 100644 --- a/README.md +++ b/README.md @@ -332,7 +332,7 @@ back off with an exponentially increasing wait period, to avoid two retries gett lock step and both failing (a lesson learned from Ethernet). For this purpose, Spring Retry provides `ExponentialBackoffPolicy`. Spring Retry also provides randomized versions of delay policies that are quite useful to avoid resonating between related failures in a -complex system. +complex system by adding Jitter. ## Listeners diff --git a/src/main/java/org/springframework/retry/annotation/Backoff.java b/src/main/java/org/springframework/retry/annotation/Backoff.java index 17610de0..666867ab 100644 --- a/src/main/java/org/springframework/retry/annotation/Backoff.java +++ b/src/main/java/org/springframework/retry/annotation/Backoff.java @@ -116,7 +116,7 @@ /** * In the exponential case ({@link #multiplier()} > 0) set this to true to have the - * backoff delays randomized, so that the maximum delay is multiplier times the + * backoff delays randomized with Jitter, so that the maximum delay is multiplier times the * previous delay and the distribution is uniform between the two values. * @return the flag to signal randomization is required (default false) */ diff --git a/src/main/java/org/springframework/retry/backoff/ExponentialRandomBackOffPolicy.java b/src/main/java/org/springframework/retry/backoff/ExponentialRandomBackOffPolicy.java index 70dc14f9..de6e865e 100644 --- a/src/main/java/org/springframework/retry/backoff/ExponentialRandomBackOffPolicy.java +++ b/src/main/java/org/springframework/retry/backoff/ExponentialRandomBackOffPolicy.java @@ -27,6 +27,7 @@ * deterministic exponential. The random multiple is uniformly distributed between 1 and * the deterministic multiplier (so in practice the interval is somewhere between the next * and next but one intervals in the deterministic case). + * This is often referred to as Jitter. * * This has shown to at least be useful in testing scenarios where excessive contention is * generated by the test needing many retries. In test, usually threads are started at the From a0fefc7bee5adb84b3764ff74ade625e0e9013b4 Mon Sep 17 00:00:00 2001 From: liran2000 Date: Tue, 29 Aug 2023 19:35:55 +0300 Subject: [PATCH 2/3] fix build format Signed-off-by: liran2000 --- .../java/org/springframework/retry/annotation/Backoff.java | 4 ++-- .../retry/backoff/ExponentialRandomBackOffPolicy.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/springframework/retry/annotation/Backoff.java b/src/main/java/org/springframework/retry/annotation/Backoff.java index 666867ab..20824dce 100644 --- a/src/main/java/org/springframework/retry/annotation/Backoff.java +++ b/src/main/java/org/springframework/retry/annotation/Backoff.java @@ -116,8 +116,8 @@ /** * In the exponential case ({@link #multiplier()} > 0) set this to true to have the - * backoff delays randomized with Jitter, so that the maximum delay is multiplier times the - * previous delay and the distribution is uniform between the two values. + * backoff delays randomized with Jitter, so that the maximum delay is multiplier + * times the previous delay and the distribution is uniform between the two values. * @return the flag to signal randomization is required (default false) */ boolean random() default false; diff --git a/src/main/java/org/springframework/retry/backoff/ExponentialRandomBackOffPolicy.java b/src/main/java/org/springframework/retry/backoff/ExponentialRandomBackOffPolicy.java index de6e865e..744217ca 100644 --- a/src/main/java/org/springframework/retry/backoff/ExponentialRandomBackOffPolicy.java +++ b/src/main/java/org/springframework/retry/backoff/ExponentialRandomBackOffPolicy.java @@ -26,8 +26,8 @@ * that chooses a random multiple of the interval that would come from a simple * deterministic exponential. The random multiple is uniformly distributed between 1 and * the deterministic multiplier (so in practice the interval is somewhere between the next - * and next but one intervals in the deterministic case). - * This is often referred to as Jitter. + * and next but one intervals in the deterministic case). This is often referred to as + * Jitter. * * This has shown to at least be useful in testing scenarios where excessive contention is * generated by the test needing many retries. In test, usually threads are started at the From ef2be5ce24e1ec2f947849a6b7a609340452a955 Mon Sep 17 00:00:00 2001 From: Gary Russell Date: Mon, 11 Sep 2023 13:20:26 -0400 Subject: [PATCH 3/3] Decapitalize jitter. --- README.md | 2 +- src/main/java/org/springframework/retry/annotation/Backoff.java | 2 +- .../retry/backoff/ExponentialRandomBackOffPolicy.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d82de812..60fa6e34 100644 --- a/README.md +++ b/README.md @@ -332,7 +332,7 @@ back off with an exponentially increasing wait period, to avoid two retries gett lock step and both failing (a lesson learned from Ethernet). For this purpose, Spring Retry provides `ExponentialBackoffPolicy`. Spring Retry also provides randomized versions of delay policies that are quite useful to avoid resonating between related failures in a -complex system by adding Jitter. +complex system, by adding jitter. ## Listeners diff --git a/src/main/java/org/springframework/retry/annotation/Backoff.java b/src/main/java/org/springframework/retry/annotation/Backoff.java index 20824dce..06c366f9 100644 --- a/src/main/java/org/springframework/retry/annotation/Backoff.java +++ b/src/main/java/org/springframework/retry/annotation/Backoff.java @@ -116,7 +116,7 @@ /** * In the exponential case ({@link #multiplier()} > 0) set this to true to have the - * backoff delays randomized with Jitter, so that the maximum delay is multiplier + * backoff delays randomized with jitter, so that the maximum delay is multiplier * times the previous delay and the distribution is uniform between the two values. * @return the flag to signal randomization is required (default false) */ diff --git a/src/main/java/org/springframework/retry/backoff/ExponentialRandomBackOffPolicy.java b/src/main/java/org/springframework/retry/backoff/ExponentialRandomBackOffPolicy.java index 744217ca..2dcc9b17 100644 --- a/src/main/java/org/springframework/retry/backoff/ExponentialRandomBackOffPolicy.java +++ b/src/main/java/org/springframework/retry/backoff/ExponentialRandomBackOffPolicy.java @@ -27,7 +27,7 @@ * deterministic exponential. The random multiple is uniformly distributed between 1 and * the deterministic multiplier (so in practice the interval is somewhere between the next * and next but one intervals in the deterministic case). This is often referred to as - * Jitter. + * jitter. * * This has shown to at least be useful in testing scenarios where excessive contention is * generated by the test needing many retries. In test, usually threads are started at the