I am using Apache HTTP async client and I have to some configurations about it.
I have the following code, but I am confused when setting RequestConfig and IOReactorConfig because you can specify the timeouts configs for both of them.
My Question is: what are the difference of the timeouts between two of these configs? Is it double work and I can just set on one of the Config? Or, the timeouts of these two Configs are controlling different things?
RequestConfig requestConfig = RequestConfig.custom() .setSocketTimeout(socketTimeout) .setConnectTimeout(connectionTimeout) .setConnectionRequestTimeout(connectionRequestTimeout) .build(); // Create I/O reactor configuration IOReactorConfig ioReactorConfig = IOReactorConfig.custom() .setIoThreadCount(Runtime.getRuntime().availableProcessors()) .setConnectTimeout(connectionTimeout) .setSoTimeout(socketTimeout) .build(); // Create a custom I/O reactort ConnectingIOReactor ioReactor = new DefaultConnectingIOReactor(ioReactorConfig); PoolingNHttpClientConnectionManager cm = new PoolingNHttpClientConnectionManager(ioReactor); cm.setMaxTotal(maxConnTotal); cm.setDefaultMaxPerRoute(maxConnPerRoute); HttpAsyncClientBuilder defaultBuilder = HttpAsyncClients.custom() .setDefaultRequestConfig(requestConfig) .setConnectionManager(cm) .setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE) .setRedirectStrategy(new LaxRedirectStrategy());