File tree Expand file tree Collapse file tree 1 file changed +22
-5
lines changed
api/src/main/java/org/asynchttpclient/channel/pool Expand file tree Collapse file tree 1 file changed +22
-5
lines changed Original file line number Diff line number Diff line change 18
18
19
19
public interface ConnectionPoolPartitioning {
20
20
21
- Object getPartitionKey (Uri uri , ProxyServer proxy );
21
+ public class ProxyPartitionKey {
22
+ private final String proxyUrl ;
23
+ private final String targetHostBaseUrl ;
24
+
25
+ public ProxyPartitionKey (String proxyUrl , String targetHostBaseUrl ) {
26
+ this .proxyUrl = proxyUrl ;
27
+ this .targetHostBaseUrl = targetHostBaseUrl ;
28
+ }
29
+
30
+ @ Override
31
+ public String toString () {
32
+ return new StringBuilder ()//
33
+ .append ("ProxyPartitionKey(proxyUrl=" ).append (proxyUrl )//
34
+ .append (", targetHostBaseUrl=" ).append (targetHostBaseUrl )//
35
+ .toString ();
36
+ }
37
+ }
38
+
39
+ Object getPartitionKey (Uri uri , ProxyServer proxyServer );
22
40
23
41
public enum PerHostConnectionPoolPartitioning implements ConnectionPoolPartitioning {
24
42
25
43
INSTANCE ;
26
44
27
- @ Override
28
- public String getPartitionKey (Uri uri , ProxyServer proxyServer ) {
29
- String serverPart = AsyncHttpProviderUtils .getBaseUrl (uri );
30
- return proxyServer != null ? proxyServer .getUrl () + serverPart : serverPart ;
45
+ public Object getPartitionKey (Uri uri , ProxyServer proxyServer ) {
46
+ String targetHostBaseUrl = AsyncHttpProviderUtils .getBaseUrl (uri );
47
+ return proxyServer != null ? new ProxyPartitionKey (proxyServer .getUrl (), targetHostBaseUrl ) : targetHostBaseUrl ;
31
48
}
32
49
}
33
50
}
You can’t perform that action at this time.
0 commit comments