On 5/17/2018 3:51 AM, Oleg Kalnichevski wrote:
HttpClientBuilder in HC4 got overloaded with so many connection
management parameters which could easily get rendered ineffective by
explicitly passing an instance of HttpClientConnectionManager to the
builder.
The same could with HC5 would look like that.
Thanks for the information on how to set the parameters I was looking
for. I've upgraded to HC5 in one app, and all the tests are still
passing. It also seems to work with real traffic.
I'm explicitly creating the inner objects rather than building them on
the fly like your code example does. Probably no real difference in
what actually happens on execution, I just find this code style easier
to read.
final SocketConfig sc =
SocketConfig.custom().setSoTimeout(Timeout.ofSeconds(10)).build();
final HttpClientConnectionManager cm =
PoolingHttpClientConnectionManagerBuilder.create()
.setMaxConnTotal(1000).setMaxConnPerRoute(200).setDefaultSocketConfig(sc).build();
final RequestConfig rc =
RequestConfig.custom().setConnectionTimeout(Timeout.ofSeconds(5))
.build();
final CloseableHttpClient client =
HttpClientBuilder.create().setConnectionManager(cm)
.setDefaultRequestConfig(rc).build();
Are there any plans to make the creation of builder objects more
uniform? Sometimes it's custom(), sometimes it's create().It would be
nice if there was consistency.
Thanks,
Shawn
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]