diff --git a/spring-core/src/main/java/org/springframework/util/backoff/BackOff.java b/spring-core/src/main/java/org/springframework/util/backoff/BackOff.java index bd13e815ee..129e014aee 100644 --- a/spring-core/src/main/java/org/springframework/util/backoff/BackOff.java +++ b/spring-core/src/main/java/org/springframework/util/backoff/BackOff.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,11 +33,10 @@ package org.springframework.util.backoff; * else { * // sleep, e.g. Thread.sleep(waitInterval) * // retry operation - * } * } * * Once the underlying operation has completed successfully, - * the execution instance can be simply discarded. + * the execution instance can be discarded. * * @author Stephane Nicoll * @since 4.1 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 483ee8b6ee..897884ea41 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 @@ -20,12 +20,12 @@ import org.springframework.util.Assert; /** * Implementation of {@link BackOff} that increases the back off period for each - * retry attempt. When the interval has reached the {@link #setMaxInterval(long) + * retry attempt. When the interval has reached the {@linkplain #setMaxInterval(long) * max interval}, it is no longer increased. Stops retrying once the - * {@link #setMaxElapsedTime(long) max elapsed time} has been reached. + * {@linkplain #setMaxElapsedTime(long) max elapsed time} has been reached. * - *

Example: The default interval is {@value #DEFAULT_INITIAL_INTERVAL} ms, - * the default multiplier is {@value #DEFAULT_MULTIPLIER}, and the default max + *

Example: The default interval is {@value #DEFAULT_INITIAL_INTERVAL} ms; + * the default multiplier is {@value #DEFAULT_MULTIPLIER}; and the default max * interval is {@value #DEFAULT_MAX_INTERVAL}. For 10 attempts the sequence will be * as follows: * @@ -44,11 +44,12 @@ import org.springframework.util.Assert; * 10 30000 * * - *

Note that the default max elapsed time and maximum number of attempts are both - * {@link Long#MAX_VALUE}. Use {@link #setMaxElapsedTime(long)} to limit the maximum - * length of time that an instance should accumulate before returning - * {@link BackOffExecution#STOP}. Alternatively, use {@link #setMaxAttempts} to limit - * the number of attempts. The execution stops when any of those two limit is reached. + *

Note that the default max elapsed time is {@link Long#MAX_VALUE}, and the + * default maximum number of attempts is {@link Integer#MAX_VALUE}. Use + * {@link #setMaxElapsedTime(long)} to limit the length of time that an instance + * should accumulate before returning {@link BackOffExecution#STOP}. Alternatively, + * use {@link #setMaxAttempts(int)} to limit the number of attempts. The execution + * stops when either of those two limits is reached. * * @author Stephane Nicoll * @author Gary Russell @@ -181,7 +182,7 @@ public class ExponentialBackOff implements BackOff { /** * The maximum number of attempts after which a call to * {@link BackOffExecution#nextBackOff()} returns {@link BackOffExecution#STOP}. - * @param maxAttempts the maximum number of attempts. + * @param maxAttempts the maximum number of attempts * @since 6.1 * @see #setMaxElapsedTime(long) */