public class ExponentialBackoffManager extends AbstractBackoff
This implementation is specifically designed for managing connections in an HTTP route context and provides methods for probing and backing off connections based on the performance of the route.
The exponential backoff algorithm is primarily implemented in the getBackedOffPoolSize
method, which calculates the new connection pool size based on the current pool size, growth rate,
and the number of time intervals.
Constructor and Description |
---|
ExponentialBackoffManager(org.apache.hc.core5.pool.ConnPoolControl<HttpRoute> connPerRoute)
Constructs a new ExponentialBackoffManager with the specified connection pool control.
|
Modifier and Type | Method and Description |
---|---|
protected int |
getBackedOffPoolSize(int curr)
Calculates the new pool size after applying the exponential backoff algorithm.
|
void |
setBackoffFactor(double rate)
Sets the backoff factor for the backoff algorithm.
|
backOff, getBackoffFactor, getCap, getConnPerRoute, getCoolDown, getLastRouteBackoffs, getLastRouteProbes, getLastUpdate, getTimeInterval, probe, setCoolDown, setPerHostConnectionCap
public ExponentialBackoffManager(org.apache.hc.core5.pool.ConnPoolControl<HttpRoute> connPerRoute)
connPerRoute
- the connection pool control to be used for managing connectionsIllegalArgumentException
- if connPerRoute is nullprotected int getBackedOffPoolSize(int curr)
getBackedOffPoolSize
in class AbstractBackoff
curr
- the current pool sizepublic void setBackoffFactor(double rate)
AbstractBackoff
rate
- the backoff factor to be setCopyright © 1999–2021 The Apache Software Foundation. All rights reserved.