@Contract(threading=STATELESS) public class ExponentialBackOffSchedulingStrategy extends Object implements SchedulingStrategy
no delay in case it was never tried or didn't fail so far 6 s delay for one failed attempt (=The following equation is used to calculate the delay for a specific pending operation:getInitialExpiry()
) 60 s delay for two failed attempts 10 min delay for three failed attempts 100 min delay for four failed attempts ~16 h delay for five failed attempts 24 h delay for six or more failed attempts (=getMaxExpiry()
)
delay =The resulting delay won't exceedgetInitialExpiry()
* Math.pow(getBackOffRate()
,consecutiveFailedAttempts
- 1))
getMaxExpiry()
.Modifier and Type | Field and Description |
---|---|
static long |
DEFAULT_BACK_OFF_RATE |
static org.apache.hc.core5.util.TimeValue |
DEFAULT_INITIAL_EXPIRY |
static org.apache.hc.core5.util.TimeValue |
DEFAULT_MAX_EXPIRY |
Constructor and Description |
---|
ExponentialBackOffSchedulingStrategy() |
ExponentialBackOffSchedulingStrategy(long backOffRate) |
ExponentialBackOffSchedulingStrategy(long backOffRate,
org.apache.hc.core5.util.TimeValue initialExpiry) |
ExponentialBackOffSchedulingStrategy(long backOffRate,
org.apache.hc.core5.util.TimeValue initialExpiry,
org.apache.hc.core5.util.TimeValue maxExpiry) |
Modifier and Type | Method and Description |
---|---|
protected org.apache.hc.core5.util.TimeValue |
calculateDelay(int consecutiveFailedAttempts) |
long |
getBackOffRate() |
org.apache.hc.core5.util.TimeValue |
getInitialExpiry() |
org.apache.hc.core5.util.TimeValue |
getMaxExpiry() |
org.apache.hc.core5.util.TimeValue |
schedule(int attemptNumber)
Schedules execution time for an operation.
|
public static final long DEFAULT_BACK_OFF_RATE
public static final org.apache.hc.core5.util.TimeValue DEFAULT_INITIAL_EXPIRY
public static final org.apache.hc.core5.util.TimeValue DEFAULT_MAX_EXPIRY
public ExponentialBackOffSchedulingStrategy(long backOffRate, org.apache.hc.core5.util.TimeValue initialExpiry, org.apache.hc.core5.util.TimeValue maxExpiry)
public ExponentialBackOffSchedulingStrategy(long backOffRate, org.apache.hc.core5.util.TimeValue initialExpiry)
public ExponentialBackOffSchedulingStrategy(long backOffRate)
public ExponentialBackOffSchedulingStrategy()
public org.apache.hc.core5.util.TimeValue schedule(int attemptNumber)
SchedulingStrategy
schedule
in interface SchedulingStrategy
public long getBackOffRate()
public org.apache.hc.core5.util.TimeValue getInitialExpiry()
public org.apache.hc.core5.util.TimeValue getMaxExpiry()
protected org.apache.hc.core5.util.TimeValue calculateDelay(int consecutiveFailedAttempts)
Copyright © 1999–2021 The Apache Software Foundation. All rights reserved.