hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jammy Chen <jamm...@gmail.com>
Subject HttpPost object needs to be explicitly released?
Date Mon, 31 Aug 2015 14:54:03 GMT
Hi,

Do I need explicitly release HttpPost object?

I am using HttpClient 4.3.6 in multiple-thread environment,  I read the
guide from
http://hc.apache.org/httpcomponents-client-4.3.x/tutorial/html/fundamentals.html#d5e74,
but it does not indicates we need call httpPost.releaseConnection() or
httpPost.close().

I know we should consume the HTTP response stream, close the stream, close
the response and also close the HTTP client instance, from the guide above,
it mentioned calling httpResponse.close() it will shutdown the http
connections already.

I am now having problem multiple-thread environment, after using
httpPost.releaseConnection() it works fine, but I am really concerned about
whether we need use it, from the the API doc of
httpPost.releaseConnection(), it says only for convenient http client 3
API.

If it is needed, where should be? after closing HTTP response or before
closing HTTP response.

Thanks for your help

Jammy

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message