线程数量
编辑线程数量编辑
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()); } });