Skip to content

Release CloseableHttpResponse#3

Open
laszlohordos wants to merge 1 commit into
apache:masterfrom
laszlohordos:master
Open

Release CloseableHttpResponse#3
laszlohordos wants to merge 1 commit into
apache:masterfrom
laszlohordos:master

Conversation

@laszlohordos
Copy link
Copy Markdown

I'm using CloseableHttpResponse in httpclient-4.3 and I didn't find any other way to release the connection back to the pool. The default implementation close the DefaultHttpClient but I don't use that class.

I'm using CloseableHttpResponse in 4.3 and I didn't find any other way
to release the connection back to the pool. The default implementation
close the DefaultHttpClient but I don't use that class.
@m-van-tilburg
Copy link
Copy Markdown

@laszlohordos Looking at (currently) the only implementation of CloseableHttpResponse, namely org.apache.http.impl.execchain.HttpResponseProxy calling close() will not release the connection back to the pool but it will close the connection. To release the connection back the pool you can use org.apache.http.util.EntityUtils.consume(super.res.getEntity()). The connections in the connection pool will be closed when the PoolingHttpClientConnectionManager is closed/shutdown.

@mibo mibo added this to the 5.0.0 milestone Oct 15, 2023
@mibo mibo added the bug label Oct 15, 2023
@mibo mibo self-assigned this Oct 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants