Class ExponentialBackOffWithMaxRetries
java.lang.Object
org.springframework.util.backoff.ExponentialBackOff
org.springframework.kafka.support.ExponentialBackOffWithMaxRetries
- All Implemented Interfaces:
BackOff
Subclass of
ExponentialBackOff that allows the specification of the maximum
number of retries rather than the maximum elapsed time.
With a jitter, the intervals vary, so the number of retries
is only limited by ExponentialBackOff.getMaxAttempts(), and the maximum elapsed time is not limited.
- Since:
- 2.7.3
- Author:
- Gary Russell, Jialin Chen, Yingzi Zhang
-
Field Summary
Fields inherited from class ExponentialBackOff
DEFAULT_INITIAL_INTERVAL, DEFAULT_JITTER, DEFAULT_MAX_ATTEMPTS, DEFAULT_MAX_ELAPSED_TIME, DEFAULT_MAX_INTERVAL, DEFAULT_MULTIPLIER -
Constructor Summary
ConstructorsConstructorDescriptionExponentialBackOffWithMaxRetries(int maxRetries) Construct an instance that will calculate thesetMaxElapsedTime(long)from the maxRetries. -
Method Summary
Modifier and TypeMethodDescriptionintGet the max retries.voidsetInitialInterval(long initialInterval) voidsetJitter(long jitter) voidsetMaxElapsedTime(long maxElapsedTime) voidsetMaxInterval(long maxInterval) voidsetMultiplier(double multiplier) Methods inherited from class ExponentialBackOff
getInitialInterval, getJitter, getMaxAttempts, getMaxElapsedTime, getMaxInterval, getMultiplier, setMaxAttempts, start, toString
-
Constructor Details
-
ExponentialBackOffWithMaxRetries
public ExponentialBackOffWithMaxRetries(int maxRetries) Construct an instance that will calculate thesetMaxElapsedTime(long)from the maxRetries.- Parameters:
maxRetries- the max retries; 0 or less for no retries.
-
-
Method Details
-
getMaxRetries
public int getMaxRetries()Get the max retries.- Returns:
- the max retries.
-
setInitialInterval
public void setInitialInterval(long initialInterval) - Overrides:
setInitialIntervalin classExponentialBackOff
-
setMultiplier
public void setMultiplier(double multiplier) - Overrides:
setMultiplierin classExponentialBackOff
-
setMaxInterval
public void setMaxInterval(long maxInterval) - Overrides:
setMaxIntervalin classExponentialBackOff
-
setJitter
public void setJitter(long jitter) - Overrides:
setJitterin classExponentialBackOff
-
setMaxElapsedTime
public void setMaxElapsedTime(long maxElapsedTime) - Overrides:
setMaxElapsedTimein classExponentialBackOff
-