hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: PoolingClientConnectionManager how to close a selected connection
Date Tue, 18 Dec 2012 13:27:21 GMT
On Tue, 2012-12-18 at 09:24 +0000, Alex wrote:
> Hi,
> I'm using PoolingClientConnectionManager to obtain a HttpClient and after execute a HttpPost
where I set 1 to max for the pool.
> 
> Looking at connection state with netstat I see the connection status in ESTABLISHED (and
this is the right behavoir that I expect) for all my test.
> How is possible to force PoolingClientConnectionManager  to close a specifice connection
and recreate a new one ?
> In my code I tried to use releaseConnection() but the status not change in the netstatlist
and if I use httpClient.getConnectionManager().shutdown() (used previously to kill the connection
but with not Pooled connection ) the PoolingClientConnectionManager became not working
> 
> 
> Thank you very much

You can use a custom keep alive strategy and set the keep-alive period
for persistent connections to some finite value in milliseconds.
Persistent connections will not be re-used once that period expires. You
can also use #closeExpiredConnections() of the connection manager to
pro-actively evict expired connections from the pool.

Hope this helps

Oleg  


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Mime
View raw message