You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by 安 琦 <cy...@live.cn> on 2018/09/18 02:38:03 UTC

Confused about PoolingHttpClientConnectionManager's mechanism

Hi,

I'm using httpclient-4.5.5.

I used a single HttpClient instance with PoolingHttpClientConnectionManager.
When the execute() method finished,I called one of the methods response.close()/request.releaseConnection()/request.abortConnection() in the finally block.

However,no matter which method I called, I found ConnectionHolder#releaseConnection(false) would be invoked,and then the connection would be closed and discarded by the pool.

So I'm confused about the connection reusing mechanism.How does it work?

Thank you.


Re: Confused about PoolingHttpClientConnectionManager's mechanism

Posted by Bernd Eckenfels <ec...@zusammenkunft.net>.
Hello,

Did you actually read/consumed everything of the InputStream and is this a HTTP/1.1 service with Keepalive?

Gruss
Bernd


Gruss
Bernd
--
http://bernd.eckenfels.net

________________________________
Von: �� �� <cy...@live.cn>
Gesendet: Dienstag, September 18, 2018 11:32 AM
An: httpclient-users@hc.apache.org
Betreff: Confused about PoolingHttpClientConnectionManager's mechanism

Hi,

I'm using httpclient-4.5.5.

I used a single HttpClient instance with PoolingHttpClientConnectionManager.
When the execute() method finished,I called one of the methods response.close()/request.releaseConnection()/request.abortConnection() in the finally block.

However,no matter which method I called, I found ConnectionHolder#releaseConnection(false) would be invoked,and then the connection would be closed and discarded by the pool.

So I'm confused about the connection reusing mechanism.How does it work?

Thank you.

B�KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKCB??[��X��ܚX�KK[XZ[??Y[?]\�\��][��X��ܚX�P˘\X?K�ܙ�B��܈Y][ۘ[��[X[??K[XZ[??Y[?]\�\��Z[˘\X?K�ܙ�B�B