On Thu, 2018-05-17 at 09:17 -0600, Shawn Heisey wrote: > 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(); >
Hi Shawn > 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. > Up to this point, config beans used to have #custom method instead of a standalone builder class. All standalone builder classes used to have #create method. This looks consistent enough to be but I am very open to different ideas and tweaking config bean classes. The reason we are having a long BETA phase, so that people could contribute API improvements and changes. Oleg --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
