Package org.zalando.fahrschein
Class ExponentialBackoffStrategy
- java.lang.Object
-
- org.zalando.fahrschein.ExponentialBackoffStrategy
-
- All Implemented Interfaces:
BackoffStrategy
- Direct Known Subclasses:
EqualJitterBackoffStrategy,FullJitterBackoffStrategy
public class ExponentialBackoffStrategy extends Object implements BackoffStrategy
-
-
Field Summary
Fields Modifier and Type Field Description static doubleDEFAULT_BACKOFF_FACTORstatic intDEFAULT_INITIAL_DELAYstatic longDEFAULT_MAX_DELAY
-
Constructor Summary
Constructors Modifier Constructor Description ExponentialBackoffStrategy()ExponentialBackoffStrategy(int initialDelay, double backoffFactor, long maxDelay, int maxRetries)protectedExponentialBackoffStrategy(ExponentialBackoffStrategy other)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected longcalculateDelay(double count)<T> Tcall(int initialExceptionCount, IOException initialException, IOCallable<T> callable)ExponentialBackoffStrategywithMaxRetries(int maxRetries)
-
-
-
Field Detail
-
DEFAULT_INITIAL_DELAY
public static final int DEFAULT_INITIAL_DELAY
- See Also:
- Constant Field Values
-
DEFAULT_BACKOFF_FACTOR
public static final double DEFAULT_BACKOFF_FACTOR
- See Also:
- Constant Field Values
-
DEFAULT_MAX_DELAY
public static final long DEFAULT_MAX_DELAY
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ExponentialBackoffStrategy
public ExponentialBackoffStrategy()
-
ExponentialBackoffStrategy
public ExponentialBackoffStrategy(int initialDelay, double backoffFactor, long maxDelay, int maxRetries)
-
ExponentialBackoffStrategy
protected ExponentialBackoffStrategy(ExponentialBackoffStrategy other)
-
-
Method Detail
-
withMaxRetries
public ExponentialBackoffStrategy withMaxRetries(int maxRetries)
-
calculateDelay
protected long calculateDelay(double count)
-
call
public <T> T call(int initialExceptionCount, IOException initialException, IOCallable<T> callable) throws BackoffException, InterruptedException- Specified by:
callin interfaceBackoffStrategy- Throws:
BackoffExceptionInterruptedException
-
-