hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joan Balagueró <joan.balagu...@grupoventus.com>
Subject RE: Fw:Fw:PoolingHttpClientConnectionManager how to reuse the connection
Date Fri, 24 Apr 2015 11:22:26 GMT

Regarding this posts:

> Any help in this issue would be much appreciated. 
> Thanks
> mrhuang

> I am not quite sure I understand the issue. You should not even be using #releaseConnection
in the first place. It is provided for compatibility with HC 3.x. You should always close
CloseableHttpResponse in a try-finally or try-with-resources.
> Oleg

You say that using CloseableHttpResponse is the right way to release a connection. Currently,
our code to release a connection is the above (works fine):

  if (entity != null)
   try { EntityUtils.consume(entity); }
   catch (Exception e) {}
   if (objPost != null) objPost.abort();
   else if (objGet != null) objGet.abort();

Do you think it's preferrable to change this code by one that directly closes the CloseableHttpResponse?



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

View raw message