@@ -84,6 +84,7 @@ public class DefaultAsyncHttpClientConfig implements AsyncHttpClientConfig {
84
84
private final int connectionTtl ;
85
85
private final int maxConnections ;
86
86
private final int maxConnectionsPerHost ;
87
+ private final int acquireFreeChannelTimeout ;
87
88
private final ChannelPool channelPool ;
88
89
private final ConnectionSemaphoreFactory connectionSemaphoreFactory ;
89
90
private final KeepAliveStrategy keepAliveStrategy ;
@@ -163,6 +164,7 @@ private DefaultAsyncHttpClientConfig(// http
163
164
int connectionTtl ,
164
165
int maxConnections ,
165
166
int maxConnectionsPerHost ,
167
+ int acquireFreeChannelTimeout ,
166
168
ChannelPool channelPool ,
167
169
ConnectionSemaphoreFactory connectionSemaphoreFactory ,
168
170
KeepAliveStrategy keepAliveStrategy ,
@@ -250,6 +252,7 @@ private DefaultAsyncHttpClientConfig(// http
250
252
this .connectionTtl = connectionTtl ;
251
253
this .maxConnections = maxConnections ;
252
254
this .maxConnectionsPerHost = maxConnectionsPerHost ;
255
+ this .acquireFreeChannelTimeout = acquireFreeChannelTimeout ;
253
256
this .channelPool = channelPool ;
254
257
this .connectionSemaphoreFactory = connectionSemaphoreFactory ;
255
258
this .keepAliveStrategy = keepAliveStrategy ;
@@ -445,6 +448,9 @@ public int getMaxConnectionsPerHost() {
445
448
return maxConnectionsPerHost ;
446
449
}
447
450
451
+ @ Override
452
+ public int getAcquireFreeChannelTimeout () { return acquireFreeChannelTimeout ; }
453
+
448
454
@ Override
449
455
public ChannelPool getChannelPool () {
450
456
return channelPool ;
@@ -696,6 +702,7 @@ public static class Builder {
696
702
private int connectionTtl = defaultConnectionTtl ();
697
703
private int maxConnections = defaultMaxConnections ();
698
704
private int maxConnectionsPerHost = defaultMaxConnectionsPerHost ();
705
+ private int acquireFreeChannelTimeout = defaultAcquireFreeChannelTimeout ();
699
706
private ChannelPool channelPool ;
700
707
private ConnectionSemaphoreFactory connectionSemaphoreFactory ;
701
708
private KeepAliveStrategy keepAliveStrategy = new DefaultKeepAliveStrategy ();
@@ -991,6 +998,16 @@ public Builder setMaxConnectionsPerHost(int maxConnectionsPerHost) {
991
998
return this ;
992
999
}
993
1000
1001
+ /**
1002
+ * Sets the maximum duration in milliseconds to acquire a free channel to send a request
1003
+ * @param acquireFreeChannelTimeout maximum duration in milliseconds to acquire a free channel to send a request
1004
+ * @return the same builder instance
1005
+ */
1006
+ public Builder setAcquireFreeChannelTimeout (int acquireFreeChannelTimeout ) {
1007
+ this .acquireFreeChannelTimeout = acquireFreeChannelTimeout ;
1008
+ return this ;
1009
+ }
1010
+
994
1011
public Builder setChannelPool (ChannelPool channelPool ) {
995
1012
this .channelPool = channelPool ;
996
1013
return this ;
@@ -1249,6 +1266,7 @@ public DefaultAsyncHttpClientConfig build() {
1249
1266
connectionTtl ,
1250
1267
maxConnections ,
1251
1268
maxConnectionsPerHost ,
1269
+ acquireFreeChannelTimeout ,
1252
1270
channelPool ,
1253
1271
connectionSemaphoreFactory ,
1254
1272
keepAliveStrategy ,
0 commit comments