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