Jim Ma
2018-04-12 07:44:30 UTC
Hi,
When I tried to create http client with
a PoolingHttpClientConnectionManager and send get request to read the chunk
body with the following lines:
httpClient = HttpClientBuilder.create()
.setConnectionManager(poolingHttpClientConnectionManager)
.disableContentCompression().build();
...
HttpResposne res = httpClient.execute(httpGetMethod, ctx);
InputStream inputStream = res.getEntity().getContent();
//read inputstream
After read several bytes or not even read from InputStream, I'd like to
drop the response message and release the connection at any time without
waiting the empty chunk arrives.
But the inputstream here is an EofSensorInputStream which can only release
the connection after the response is consumed, so when I call
inputstream.close() it actually blocks there and wait the terminating
chunk.
Is there any approach that I can force to release this connection to pool
without discard it and make keep-alive work ?
Thanks,
Jim
When I tried to create http client with
a PoolingHttpClientConnectionManager and send get request to read the chunk
body with the following lines:
httpClient = HttpClientBuilder.create()
.setConnectionManager(poolingHttpClientConnectionManager)
.disableContentCompression().build();
...
HttpResposne res = httpClient.execute(httpGetMethod, ctx);
InputStream inputStream = res.getEntity().getContent();
//read inputstream
After read several bytes or not even read from InputStream, I'd like to
drop the response message and release the connection at any time without
waiting the empty chunk arrives.
But the inputstream here is an EofSensorInputStream which can only release
the connection after the response is consumed, so when I call
inputstream.close() it actually blocks there and wait the terminating
chunk.
Is there any approach that I can force to release this connection to pool
without discard it and make keep-alive work ?
Thanks,
Jim