A pool of persistent HTTP connections.
Connections are stored using keys, which should be chosen such that any connections stored under a given key can be used interchangeably.
Failed requests done using previously cached connections will be retried once if they use an idempotent method (e.g. GET), in case the HTTP server timed them out.
|Instance Variable||persistent||Boolean indicating whether connections should be persistent. Connections are persistent by default.|
|Instance Variable||maxPersistentPerHost||The maximum number of cached persistent connections for a
|Instance Variable||cachedConnectionTimeout||Number of seconds a cached persistent connection will stay open before disconnecting.|
|Method||getConnection||Supply a connection, newly created or retrieved from the pool, to be used for one HTTP request.|
|Method||closeCachedConnections||Close all persistent connections and remove them from the pool.|
|Instance Variable||_factory||The factory used to connect to the proxy.|
|Instance Variable||_connections||Map (scheme, host, port) to lists of
|Method||_newConnection||Create a new connection.|
|Method||_removeConnection||Remove a connection from the cache and disconnect it.|
|Method||_putConnection||Return a persistent connection to the pool. This will be called by
booleanindicating whether idempotent requests should be retried once if no response was received.
Supply a connection, newly created or retrieved from the pool, to be used for one HTTP request.
The connection will remain out of the pool (not available to be returned from future calls to this method) until one HTTP request has been completed over it.
Afterwards, if the connection is still open, it will automatically be added to the pool.
|Parameters||key||A unique key identifying connections that can be used interchangeably.|
|endpoint||An endpoint that can be used to open a new connection if no cached connection is available.|
Create a new connection.
This implements the new connection code path for
Remove a connection from the cache and disconnect it.
Return a persistent connection to the pool. This will be called by
HTTP11ClientProtocol when the connection becomes quiescent.