Search in sources :

Example 1 with Builder

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();
}
Also used : Builder(io.searchbox.client.config.HttpClientConfig.Builder) JestClientFactory(io.searchbox.client.JestClientFactory) JestHttpClient(io.searchbox.client.http.JestHttpClient)

Aggregations

JestClientFactory (io.searchbox.client.JestClientFactory)1 Builder (io.searchbox.client.config.HttpClientConfig.Builder)1 JestHttpClient (io.searchbox.client.http.JestHttpClient)1