Class RetryStrategy.AdaptiveExponential
java.lang.Object
com.here.platform.data.client.utils.RetryStrategy.AdaptiveExponential
- All Implemented Interfaces:
RetryStrategy,Serializable,scala.Equals,scala.Product
- Enclosing interface:
- RetryStrategy
public static final class RetryStrategy.AdaptiveExponential
extends Object
implements RetryStrategy, scala.Product, Serializable
A strategy that starts with some initial interval, and then picks the next interval so that it is the longer of
the duration of the last request or an exponential increase over the previous interval.
This ensures that backoff is at least exponential, and allows the strategy to adapt to increase intervals faster
than it otherwise would when attempts take a long time (such as when an overloaded server is slow to respond).
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.here.platform.data.client.utils.RetryStrategy
RetryStrategy.AdaptiveExponential, RetryStrategy.AdaptiveExponential$, RetryStrategy.ConstantInterval, RetryStrategy.ConstantInterval$, RetryStrategy.NoRetries$, RetryStrategy.Repeat, RetryStrategy.Repeat$, RetryStrategy.SoftTimeout, RetryStrategy.SoftTimeout$, RetryStrategy.StickyCeiling, RetryStrategy.StickyCeiling$ -
Constructor Summary
ConstructorsConstructorDescriptionAdaptiveExponential(scala.concurrent.duration.FiniteDuration initialInterval, double exponentialBase) -
Method Summary
Modifier and TypeMethodDescriptionscala.util.Either<String,scala.Tuple2<scala.concurrent.duration.FiniteDuration, RetryStrategy>> apply(scala.concurrent.duration.FiniteDuration attemptDuration) Decides whether and when to retry an operation, given the duration of the most recent attempt.doublescala.concurrent.duration.FiniteDurationMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface scala.Equals
canEqual, equalsMethods inherited from interface scala.Product
productArity, productElement, productElementName, productElementNames, productIterator, productPrefix
-
Constructor Details
-
AdaptiveExponential
public AdaptiveExponential(scala.concurrent.duration.FiniteDuration initialInterval, double exponentialBase)
-
-
Method Details
-
initialInterval
public scala.concurrent.duration.FiniteDuration initialInterval() -
exponentialBase
public double exponentialBase() -
apply
public scala.util.Either<String,scala.Tuple2<scala.concurrent.duration.FiniteDuration, applyRetryStrategy>> (scala.concurrent.duration.FiniteDuration attemptDuration) Description copied from interface:RetryStrategyDecides whether and when to retry an operation, given the duration of the most recent attempt.Why is this signature so complex, you ask? To be able to express both limits on retrying, and to support the logic of
RetryStrategy.AdaptiveExponential.- Specified by:
applyin interfaceRetryStrategy- Parameters:
attemptDuration- duration of the most recent attempt- Returns:
- a
Leftcontaining the reason for not retrying the request if the operation should not be retried, or aRightcontaining the minimum interval between the start of the most recent attempt and the start of the retry together with the RetryStrategy to use if this retry fails.
-