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: PoolingHttpClientConnectionManager and CloseableHttpResponse
Date Tue, 16 Sep 2014 19:04:16 GMT
On 16/09/14 16:23 , Todd W Lainhart wrote:
>> You can just close the response. If response content has not been fully
>> consumed CloseableHttpResponse#close will NOT attempt to salvage the
>> underlying connection and will simply shut it down and release it back
>> to the pool in a non-reusable state.
>> Think of CloseableHttpResponse#close as a safe-guard for 'unhappy'
>> execution flows.
> Thanks.  I did see close getting called during execution retries, and
> wondered why that was a "special" case.  Out of curiosity, why return the
> connection to the pool in a non-reusable state, as opposed to just
> dropping it from the pool?

The connection manager has no way of knowing if a connection is still 
being used. No matter what it needs to be notified that the connection 
can be re-claimed (and either kept alive for further re-use or 
discarded). The #release method looks like a natural way of doing that.


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

View raw message