diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2023-01-05 10:34:07 +0100 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2023-01-25 10:48:48 +0100 |
commit | d8a3a7bf6d9685db965833064876d8ed02ed0699 (patch) | |
tree | 40a5491e1187a075d1a9c0b000bb9de2f215560e /vespa-feed-client | |
parent | f8338e1ea64c58a7986f929a4c3c229b92a8cfde (diff) |
VespaHttpClientBuilder follow builder pattern and add connect and socket timeout to builder.
Diffstat (limited to 'vespa-feed-client')
-rw-r--r-- | vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/ApacheCluster.java | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/ApacheCluster.java b/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/ApacheCluster.java index a097c01b76b..8b0509dc788 100644 --- a/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/ApacheCluster.java +++ b/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/ApacheCluster.java @@ -9,6 +9,7 @@ import org.apache.hc.client5.http.config.ConnectionConfig; import org.apache.hc.client5.http.config.RequestConfig; import org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient; import org.apache.hc.client5.http.impl.async.HttpAsyncClients; +import org.apache.hc.client5.http.impl.async.MinimalH2AsyncClient; import org.apache.hc.client5.http.ssl.ClientTlsStrategyBuilder; import org.apache.hc.core5.concurrent.FutureCallback; import org.apache.hc.core5.http.ContentType; @@ -175,17 +176,17 @@ class ApacheCluster implements Cluster { if (builder.hostnameVerifier != null) tlsStrategyBuilder.setHostnameVerifier(builder.hostnameVerifier); - var client = HttpAsyncClients.createHttp2Minimal(H2Config.custom() + MinimalH2AsyncClient client = HttpAsyncClients.createHttp2Minimal(H2Config.custom() .setMaxConcurrentStreams(builder.maxStreamsPerConnection) .setCompressionEnabled(true) .setPushEnabled(false) .setInitialWindowSize(Integer.MAX_VALUE) .build(), IOReactorConfig.custom() - .setIoThreadCount(2) - .setTcpNoDelay(true) - .setSoTimeout(Timeout.ofSeconds(10)) - .build(), + .setIoThreadCount(2) + .setTcpNoDelay(true) + .setSoTimeout(Timeout.ofSeconds(10)) + .build(), tlsStrategyBuilder.build()); client.setConnectionConfigResolver(host -> connectionConfig); return client; |