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.

Oleg

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to