From 1370a833edbd68027467cc04db85be34a60a2c0d Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Fri, 9 Jan 2026 15:37:32 +0100 Subject: [PATCH] Further clarify the meaning of maxAttempts in FixedBackOff and ExponentialBackOff See gh-36119 --- .../springframework/util/backoff/ExponentialBackOff.java | 6 +++--- .../java/org/springframework/util/backoff/FixedBackOff.java | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/spring-core/src/main/java/org/springframework/util/backoff/ExponentialBackOff.java b/spring-core/src/main/java/org/springframework/util/backoff/ExponentialBackOff.java index 8aefd231ea2..fd48e023e15 100644 --- a/spring-core/src/main/java/org/springframework/util/backoff/ExponentialBackOff.java +++ b/spring-core/src/main/java/org/springframework/util/backoff/ExponentialBackOff.java @@ -52,7 +52,7 @@ import org.springframework.util.Assert; * should accumulate before returning {@link BackOffExecution#STOP}. * Alternatively, use {@link #setMaxAttempts} to limit the number of back-off * attempts (in a retry scenario, this is equivalent to the maximum number of - * retries in addition to the original invocation). + * retries excluding the original invocation). * The execution stops when either of those two limits is reached. * * @author Stephane Nicoll @@ -231,7 +231,7 @@ public class ExponentialBackOff implements BackOff { * The maximum number of back-off attempts after which a call to * {@link BackOffExecution#nextBackOff()} returns {@link BackOffExecution#STOP}. *
Note that in a retry scenario, this is equivalent to the maximum number - * of retries in addition to the original invocation. + * of retries excluding the original invocation. * @param maxAttempts the maximum number of attempts * @since 6.1 * @see #setMaxElapsedTime @@ -244,7 +244,7 @@ public class ExponentialBackOff implements BackOff { * Return the maximum number of back-off attempts after which a call to * {@link BackOffExecution#nextBackOff()} returns {@link BackOffExecution#STOP}. *
Note that in a retry scenario, this is equivalent to the maximum number - * of retries in addition to the original invocation. + * of retries excluding the original invocation. * @return the maximum number of attempts * @since 6.1 * @see #getMaxElapsedTime() diff --git a/spring-core/src/main/java/org/springframework/util/backoff/FixedBackOff.java b/spring-core/src/main/java/org/springframework/util/backoff/FixedBackOff.java index 33c16314034..18acdeb49f4 100644 --- a/spring-core/src/main/java/org/springframework/util/backoff/FixedBackOff.java +++ b/spring-core/src/main/java/org/springframework/util/backoff/FixedBackOff.java @@ -20,7 +20,7 @@ package org.springframework.util.backoff; * A simple {@link BackOff} implementation that provides a fixed interval * between two attempts and a maximum number of back-off attempts (in a * retry scenario, this is equivalent to the maximum number of retries - * in addition to the original invocation). + * excluding the original invocation). * * @author Stephane Nicoll * @author Sam Brannen @@ -92,7 +92,7 @@ public class FixedBackOff implements BackOff { /** * Set the maximum number of back-off attempts. *
Note that in a retry scenario, this is equivalent to the maximum number - * of retries in addition to the original invocation. + * of retries excluding the original invocation. */ public void setMaxAttempts(long maxAttempts) { this.maxAttempts = maxAttempts; @@ -101,7 +101,7 @@ public class FixedBackOff implements BackOff { /** * Return the maximum number of back-off attempts. *
Note that in a retry scenario, this is equivalent to the maximum number - * of retries in addition to the original invocation. + * of retries excluding the original invocation. */ public long getMaxAttempts() { return this.maxAttempts;