use of io.searchbox.client.config.HttpClientConfig.Builder in project gerrit by GerritCodeReview.
the class JestClientBuilder method build.
JestHttpClient build() {
JestClientFactory factory = new JestClientFactory();
Builder builder = new HttpClientConfig.Builder(cfg.urls).multiThreaded(true).discoveryEnabled(false).connTimeout((int) cfg.connectionTimeout).maxConnectionIdleTime(cfg.maxConnectionIdleTime, cfg.maxConnectionIdleUnit).maxTotalConnection(cfg.maxTotalConnection).readTimeout(cfg.readTimeout).requestCompressionEnabled(cfg.requestCompression).discoveryFrequency(1L, TimeUnit.MINUTES);
if (cfg.username != null && cfg.password != null) {
builder.defaultCredentials(cfg.username, cfg.password);
}
factory.setHttpClientConfig(builder.build());
return (JestHttpClient) factory.getObject();
}
Aggregations