线程数
编辑线程数
编辑Apache Http Async Client 默认启动一个调度线程,以及连接管理器使用的工作线程,其数量与本地检测到的处理器数量相同(取决于 Runtime.getRuntime().availableProcessors()
返回的值)。线程数可以按如下方式修改:
RestClientBuilder builder = RestClient.builder( new HttpHost("localhost", 9200)) .setHttpClientConfigCallback(new HttpClientConfigCallback() { @Override public HttpAsyncClientBuilder customizeHttpClient( HttpAsyncClientBuilder httpClientBuilder) { return httpClientBuilder.setDefaultIOReactorConfig( IOReactorConfig.custom() .setIoThreadCount(1) .build()); } });