On Wed, 2018-05-16 at 14:11 -0600, Shawn Heisey wrote: > On 5/16/2018 8:42 AM, Shawn Heisey wrote: > > RequestConfig rc = > > RequestConfig.custom().setConnectTimeout(15000) > > .setSocketTimeout(120000).build(); > > httpClient = HttpClients.custom().setDefaultRequestConfig(rc) > > .setMaxConnPerRoute(300).setMaxConnTotal(5000).disableAutomaticRetr > > ies() > > .build(); > > I have attempted to upgrade httpclient in one of my projects from > 4.5.x > to the latest 5.0 beta release, and this code no longer compiles. On > RequestConfig.Builder, the setSocketTimeout method no longer exists. > On > HttpClientBuilder, the setMaxConnPerRoute and setMaxConnTotal methods > no > longer exist. These methods were not deprecated in 4.5.x. > > Is it still possible to set a socket timeout default? Is it still > possible to increase the maximum number of connections that a client > can > make? If so, how is it done? > > Thanks, > Shawn >
Hi Shawn 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. --- CloseableHttpClient client = HttpClientBuilder.create() .setConnectionManager(PoolingHttpClientConnectionManagerBuilder.create() .setMaxConnTotal(200) .setMaxConnPerRoute(20) .setDefaultSocketConfig(SocketConfig.custom() .setSoTimeout(Timeout.ofMinutes(1L)) .build()) .build()) .setDefaultRequestConfig(RequestConfig.custom() .setConnectionTimeout(Timeout.ofSeconds(30L)) .build()) .build(); --- Does this help in any way? Oleg --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org For additional commands, e-mail: httpclient-users-h...@hc.apache.org