| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.http.impl.client.AIMDBackoffManager
public class AIMDBackoffManager
The AIMDBackoffManager applies an additive increase,
 multiplicative decrease (AIMD) to managing a dynamic limit to
 the number of connections allowed to a given host. You may want
 to experiment with the settings for the cooldown periods and the
 backoff factor to get the adaptive behavior you want.
Generally speaking, shorter cooldowns will lead to more steady-state variability but faster reaction times, while longer cooldowns will lead to more stable equilibrium behavior but slower reaction times.
Similarly, higher backoff factors promote greater utilization of available capacity at the expense of fairness among clients. Lower backoff factors allow equal distribution of capacity among clients (fairness) to happen faster, at the expense of having more server capacity unused in the short term.
| Constructor Summary | |
|---|---|
| AIMDBackoffManager(org.apache.http.pool.ConnPoolControl<HttpRoute> connPerRoute)Creates an AIMDBackoffManagerto manage
 per-host connection pool sizes represented by the
 givenConnPoolControl. | |
| Method Summary | |
|---|---|
|  void | backOff(HttpRoute route)Called when we have decided that the result of using a connection should be interpreted as a backoff signal. | 
|  void | probe(HttpRoute route)Called when we have determined that the result of using a connection has succeeded and that we may probe for more connections. | 
|  void | setBackoffFactor(double d)Sets the factor to use when backing off; the new per-host limit will be roughly the current max times this factor. | 
|  void | setCooldownMillis(long l)Sets the amount of time, in milliseconds, to wait between adjustments in pool sizes for a given host, to allow enough time for the adjustments to take effect. | 
|  void | setPerHostConnectionCap(int cap)Sets the absolute maximum per-host connection pool size to probe up to; defaults to 2 (the default per-host max). | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Constructor Detail | 
|---|
public AIMDBackoffManager(org.apache.http.pool.ConnPoolControl<HttpRoute> connPerRoute)
AIMDBackoffManager to manage
 per-host connection pool sizes represented by the
 given ConnPoolControl.
connPerRoute - per-host routing maximums to
   be managed| Method Detail | 
|---|
public void backOff(HttpRoute route)
BackoffManager
backOff in interface BackoffManagerpublic void probe(HttpRoute route)
BackoffManager
probe in interface BackoffManagerpublic void setBackoffFactor(double d)
Math.floor is applied in the
 case of non-integer outcomes to ensure we actually
 decrease the pool size. Pool sizes are never decreased
 below 1, however. Defaults to 0.5.
d - must be between 0.0 and 1.0, exclusive.public void setCooldownMillis(long l)
l - must be positivepublic void setPerHostConnectionCap(int cap)
cap - must be >= 1| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||