Browse Source

Further clarify the meaning of maxAttempts in FixedBackOff and ExponentialBackOff

See gh-36119
pull/36125/head
Sam Brannen 3 weeks ago
parent
commit
1370a833ed
  1. 6
      spring-core/src/main/java/org/springframework/util/backoff/ExponentialBackOff.java
  2. 6
      spring-core/src/main/java/org/springframework/util/backoff/FixedBackOff.java

6
spring-core/src/main/java/org/springframework/util/backoff/ExponentialBackOff.java

@ -52,7 +52,7 @@ import org.springframework.util.Assert; @@ -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 { @@ -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}.
* <p>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 { @@ -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}.
* <p>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()

6
spring-core/src/main/java/org/springframework/util/backoff/FixedBackOff.java

@ -20,7 +20,7 @@ package org.springframework.util.backoff; @@ -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 { @@ -92,7 +92,7 @@ public class FixedBackOff implements BackOff {
/**
* Set the maximum number of back-off attempts.
* <p>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 { @@ -101,7 +101,7 @@ public class FixedBackOff implements BackOff {
/**
* Return the maximum number of back-off attempts.
* <p>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;

Loading…
Cancel
Save