@@ -417,8 +417,8 @@ public ChannelPipeline getPipeline() throws Exception {
417
417
}
418
418
}
419
419
420
- private Channel lookupInCache (URI uri , ConnectionPoolKeyStrategy connectionPoolKeyStrategy ) {
421
- final Channel channel = connectionsPool .poll (connectionPoolKeyStrategy . getKey (uri ));
420
+ private Channel lookupInCache (URI uri , ProxyServer proxy , ConnectionPoolKeyStrategy strategy ) {
421
+ final Channel channel = connectionsPool .poll (getPoolKey (uri , proxy , strategy ));
422
422
423
423
if (channel != null ) {
424
424
log .debug ("Using cached Channel {}\n for uri {}\n " , channel , uri );
@@ -942,8 +942,7 @@ private <T> NettyResponseFuture<T> buildNettyResponseFutureWithCachedChannel(Req
942
942
if (f != null && f .reuseChannel () && f .channel () != null ) {
943
943
channel = f .channel ();
944
944
} else {
945
- URI connectionKeyUri = proxyServer != null ? proxyServer .getURI () : uri ;
946
- channel = lookupInCache (connectionKeyUri , request .getConnectionPoolKeyStrategy ());
945
+ channel = lookupInCache (uri , proxyServer , request .getConnectionPoolKeyStrategy ());
947
946
}
948
947
949
948
if (channel == null )
@@ -1318,10 +1317,11 @@ private Realm ntlmProxyChallenge(List<String> wwwAuth, Request request, ProxySer
1318
1317
}
1319
1318
1320
1319
private String getPoolKey (NettyResponseFuture <?> future ) {
1321
-
1322
- String serverPart = future .getConnectionPoolKeyStrategy ().getKey (future .getURI ());
1323
-
1324
- ProxyServer proxy = future .getProxyServer ();
1320
+ return getPoolKey (future .getURI (), future .getProxyServer (), future .getConnectionPoolKeyStrategy ());
1321
+ }
1322
+
1323
+ private String getPoolKey (URI uri , ProxyServer proxy , ConnectionPoolKeyStrategy strategy ) {
1324
+ String serverPart = strategy .getKey (uri );
1325
1325
return proxy != null ? AsyncHttpProviderUtils .getBaseUrl (proxy .getURI ()) + serverPart : serverPart ;
1326
1326
}
1327
1327
0 commit comments