diff options
author | Bjørn Christian Seime <bjorncs@yahooinc.com> | 2023-06-30 12:16:08 +0200 |
---|---|---|
committer | Bjørn Christian Seime <bjorncs@yahooinc.com> | 2023-06-30 12:23:35 +0200 |
commit | 9549bcfe1bac026604a732ef5e6b3b163bd3a100 (patch) | |
tree | e67e170a59d5a2a1cdecc2ef0c257b4a4efab424 /vespa-feed-client/src/main | |
parent | 5f4f6220e6b342f1bbbb6badf40d51b0dfe35930 (diff) |
Use `InternalH2AsyncClient` instead of `MinimalH2AsyncClient`
Diffstat (limited to 'vespa-feed-client/src/main')
-rw-r--r-- | vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/ApacheCluster.java | 38 |
1 files changed, 21 insertions, 17 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 f36178fb13a..498b8e3f9d8 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,7 +9,6 @@ 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; @@ -178,26 +177,31 @@ class ApacheCluster implements Cluster { // Socket timeout must be longer than the longest feasible response timeout Timeout socketTimeout = Timeout.ofMinutes(15); - // Note: MinimalH2AsyncClient does not support proxying or automatic retries - MinimalH2AsyncClient client = HttpAsyncClients.createHttp2Minimal( - H2Config.custom() - .setMaxConcurrentStreams(builder.maxStreamsPerConnection) - .setCompressionEnabled(true) - .setPushEnabled(false) - .setInitialWindowSize(Integer.MAX_VALUE) - .build(), - IOReactorConfig.custom() - .setIoThreadCount(Math.max(Math.min(Runtime.getRuntime().availableProcessors(), 8), 2)) - .setTcpNoDelay(true) - .setSoTimeout(socketTimeout) - .build(), - tlsStrategyBuilder.build()); ConnectionConfig connCfg = ConnectionConfig.custom() .setSocketTimeout(socketTimeout) .setConnectTimeout(Timeout.ofSeconds(10)) .build(); - client.setConnectionConfigResolver(__ -> connCfg); - return client; + + return HttpAsyncClients.customHttp2() + .setH2Config( + H2Config.custom() + .setMaxConcurrentStreams(builder.maxStreamsPerConnection) + .setCompressionEnabled(true) + .setPushEnabled(false) + .setInitialWindowSize(Integer.MAX_VALUE) + .build()) + .setIOReactorConfig( + IOReactorConfig.custom() + .setIoThreadCount(Math.max(Math.min(Runtime.getRuntime().availableProcessors(), 8), 2)) + .setTcpNoDelay(true) + .setSoTimeout(socketTimeout) + .build()) + .setTlsStrategy(tlsStrategyBuilder.build()) + .setDefaultConnectionConfig(connCfg) + .disableAutomaticRetries() + .disableRedirectHandling() + .disableCookieManagement() + .build(); } private static int portOf(URI url) { |