Polish BackOff support
This commit is contained in:
		
							parent
							
								
									962f4d20b4
								
							
						
					
					
						commit
						44167ecea4
					
				| 
						 | 
					@ -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");
 | 
					 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
				
			||||||
 * you may not use this file except in compliance with the License.
 | 
					 * you may not use this file except in compliance with the License.
 | 
				
			||||||
| 
						 | 
					@ -33,11 +33,10 @@ package org.springframework.util.backoff;
 | 
				
			||||||
 * else {
 | 
					 * else {
 | 
				
			||||||
 *     // sleep, e.g. Thread.sleep(waitInterval)
 | 
					 *     // sleep, e.g. Thread.sleep(waitInterval)
 | 
				
			||||||
 *     // retry operation
 | 
					 *     // retry operation
 | 
				
			||||||
 * }
 | 
					 | 
				
			||||||
 * }</pre>
 | 
					 * }</pre>
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * Once the underlying operation has completed successfully,
 | 
					 * Once the underlying operation has completed successfully,
 | 
				
			||||||
 * the execution instance can be simply discarded.
 | 
					 * the execution instance can be discarded.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @author Stephane Nicoll
 | 
					 * @author Stephane Nicoll
 | 
				
			||||||
 * @since 4.1
 | 
					 * @since 4.1
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -20,12 +20,12 @@ import org.springframework.util.Assert;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Implementation of {@link BackOff} that increases the back off period for each
 | 
					 * 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
 | 
					 * 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.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * <p>Example: The default interval is {@value #DEFAULT_INITIAL_INTERVAL} ms,
 | 
					 * <p>Example: The default interval is {@value #DEFAULT_INITIAL_INTERVAL} ms;
 | 
				
			||||||
 * the default multiplier is {@value #DEFAULT_MULTIPLIER}, and the default max
 | 
					 * the default multiplier is {@value #DEFAULT_MULTIPLIER}; and the default max
 | 
				
			||||||
 * interval is {@value #DEFAULT_MAX_INTERVAL}. For 10 attempts the sequence will be
 | 
					 * interval is {@value #DEFAULT_MAX_INTERVAL}. For 10 attempts the sequence will be
 | 
				
			||||||
 * as follows:
 | 
					 * as follows:
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
| 
						 | 
					@ -44,11 +44,12 @@ import org.springframework.util.Assert;
 | 
				
			||||||
 * 10             30000
 | 
					 * 10             30000
 | 
				
			||||||
 * </pre>
 | 
					 * </pre>
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * <p>Note that the default max elapsed time and maximum number of attempts are both
 | 
					 * <p>Note that the default max elapsed time is {@link Long#MAX_VALUE}, and the
 | 
				
			||||||
 * {@link Long#MAX_VALUE}. Use {@link #setMaxElapsedTime(long)} to limit the maximum
 | 
					 * default maximum number of attempts is {@link Integer#MAX_VALUE}. Use
 | 
				
			||||||
 * length of time that an instance should accumulate before returning
 | 
					 * {@link #setMaxElapsedTime(long)} to limit the length of time that an instance
 | 
				
			||||||
 * {@link BackOffExecution#STOP}. Alternatively, use {@link #setMaxAttempts} to limit
 | 
					 * should accumulate before returning {@link BackOffExecution#STOP}. Alternatively,
 | 
				
			||||||
 * the number of attempts. The execution stops when any of those two limit is reached.
 | 
					 * 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 Stephane Nicoll
 | 
				
			||||||
 * @author Gary Russell
 | 
					 * @author Gary Russell
 | 
				
			||||||
| 
						 | 
					@ -181,7 +182,7 @@ public class ExponentialBackOff implements BackOff {
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
	 * The maximum number of attempts after which a call to
 | 
						 * The maximum number of attempts after which a call to
 | 
				
			||||||
	 * {@link BackOffExecution#nextBackOff()} returns {@link BackOffExecution#STOP}.
 | 
						 * {@link BackOffExecution#nextBackOff()} returns {@link BackOffExecution#STOP}.
 | 
				
			||||||
	 * @param maxAttempts the maximum number of attempts.
 | 
						 * @param maxAttempts the maximum number of attempts
 | 
				
			||||||
	 * @since 6.1
 | 
						 * @since 6.1
 | 
				
			||||||
	 * @see #setMaxElapsedTime(long)
 | 
						 * @see #setMaxElapsedTime(long)
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue