summaryrefslogtreecommitdiffstats
path: root/vespa-feed-client
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorncs@yahooinc.com>2023-07-13 11:46:38 +0200
committerBjørn Christian Seime <bjorncs@yahooinc.com>2023-07-13 11:49:55 +0200
commit5c17b77c111288df5c3803c79478f31a88030ef5 (patch)
treef08d716442a6793a2a66b7a5d1013c8a77d620a1 /vespa-feed-client
parentb2dcd9de3f8ed19bd115ab46156c4752c6875a90 (diff)
Don't leak reference to builder instance
Diffstat (limited to 'vespa-feed-client')
-rw-r--r--vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/JettyCluster.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/JettyCluster.java b/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/JettyCluster.java
index 1a125ebfbb5..cd7a4e6222e 100644
--- a/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/JettyCluster.java
+++ b/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/JettyCluster.java
@@ -147,10 +147,11 @@ class JettyCluster implements Cluster {
h2Client.setInitialStreamRecvWindow(initialWindow);
ClientConnectionFactory.Info http2 = new ClientConnectionFactoryOverHTTP2.HTTP2(h2Client);
HttpClientTransportDynamic transport = new HttpClientTransportDynamic(connector, http2);
+ int connectionsPerEndpoint = b.connectionsPerEndpoint;
transport.setConnectionPoolFactory(dest -> {
MultiplexConnectionPool pool = new MultiplexConnectionPool(
- dest, Pool.StrategyType.RANDOM, b.connectionsPerEndpoint, false, dest, Integer.MAX_VALUE);
- pool.preCreateConnections(b.connectionsPerEndpoint);
+ dest, Pool.StrategyType.RANDOM, connectionsPerEndpoint, false, dest, Integer.MAX_VALUE);
+ pool.preCreateConnections(connectionsPerEndpoint);
return pool;
});
HttpClient httpClient = new HttpClient(transport);
@@ -186,9 +187,10 @@ class JettyCluster implements Cluster {
new HttpProxy(address, false, new Origin.Protocol(Collections.singletonList("h2c"), false)));
}
Map<String, Supplier<String>> proxyHeadersCopy = new TreeMap<>(b.proxyRequestHeaders);
+ URI proxyUri = URI.create(endpointUri(b.proxy));
if (!proxyHeadersCopy.isEmpty()) {
httpClient.getAuthenticationStore().addAuthenticationResult(new Authentication.Result() {
- @Override public URI getURI() { return URI.create(endpointUri(b.proxy)); }
+ @Override public URI getURI() { return proxyUri; }
@Override public void apply(Request r) {
r.headers(hs -> proxyHeadersCopy.forEach((k, v) -> hs.add(k, v.get())));
}