@@ -119,6 +119,11 @@ public class DefaultAsyncHttpClientConfig implements AsyncHttpClientConfig {
119
119
private final EventLoopGroup eventLoopGroup ;
120
120
private final boolean useNativeTransport ;
121
121
private final boolean usePooledMemory ;
122
+ private final boolean tcpNoDelay ;
123
+ private final boolean soReuseAddress ;
124
+ private final int soLinger ;
125
+ private final int soSndBuf ;
126
+ private final int soRcvBuf ;
122
127
private final Timer nettyTimer ;
123
128
private final ThreadFactory threadFactory ;
124
129
private final AdditionalChannelInitializer httpAdditionalChannelInitializer ;
@@ -172,6 +177,13 @@ private DefaultAsyncHttpClientConfig(//
172
177
List <ResponseFilter > responseFilters ,//
173
178
List <IOExceptionFilter > ioExceptionFilters ,//
174
179
180
+ // tuning
181
+ boolean tcpNoDelay ,//
182
+ boolean soReuseAddress ,//
183
+ int soLinger , //
184
+ int soSndBuf , //
185
+ int soRcvBuf , //
186
+
175
187
// internals
176
188
String threadPoolName ,//
177
189
int httpClientCodecMaxInitialLineLength ,//
@@ -236,6 +248,13 @@ private DefaultAsyncHttpClientConfig(//
236
248
this .responseFilters = responseFilters ;
237
249
this .ioExceptionFilters = ioExceptionFilters ;
238
250
251
+ // tuning
252
+ this .tcpNoDelay = tcpNoDelay ;
253
+ this .soReuseAddress = soReuseAddress ;
254
+ this .soLinger = soLinger ;
255
+ this .soSndBuf = soSndBuf ;
256
+ this .soRcvBuf = soRcvBuf ;
257
+
239
258
// internals
240
259
this .threadPoolName = threadPoolName ;
241
260
this .httpClientCodecMaxInitialLineLength = httpClientCodecMaxInitialLineLength ;
@@ -446,6 +465,32 @@ public List<IOExceptionFilter> getIoExceptionFilters() {
446
465
return ioExceptionFilters ;
447
466
}
448
467
468
+ // tuning
469
+ @ Override
470
+ public boolean isTcpNoDelay () {
471
+ return tcpNoDelay ;
472
+ }
473
+
474
+ @ Override
475
+ public boolean isSoReuseAddress () {
476
+ return soReuseAddress ;
477
+ }
478
+
479
+ @ Override
480
+ public int getSoLinger () {
481
+ return soLinger ;
482
+ }
483
+
484
+ @ Override
485
+ public int getSoSndBuf () {
486
+ return soSndBuf ;
487
+ }
488
+
489
+ @ Override
490
+ public int getSoRcvBuf () {
491
+ return soRcvBuf ;
492
+ }
493
+
449
494
// internals
450
495
@ Override
451
496
public String getThreadPoolName () {
@@ -580,6 +625,13 @@ public static class Builder {
580
625
private final List <ResponseFilter > responseFilters = new LinkedList <>();
581
626
private final List <IOExceptionFilter > ioExceptionFilters = new LinkedList <>();
582
627
628
+ // tuning
629
+ private boolean tcpNoDelay = defaultTcpNoDelay ();
630
+ private boolean soReuseAddress = defaultSoReuseAddress ();
631
+ private int soLinger = defaultSoLinger ();
632
+ private int soSndBuf = defaultSoSndBuf ();
633
+ private int soRcvBuf = defaultSoRcvBuf ();
634
+
583
635
// internals
584
636
private String threadPoolName = defaultThreadPoolName ();
585
637
private int httpClientCodecMaxInitialLineLength = defaultHttpClientCodecMaxInitialLineLength ();
@@ -646,6 +698,13 @@ public Builder(AsyncHttpClientConfig config) {
646
698
responseFilters .addAll (config .getResponseFilters ());
647
699
ioExceptionFilters .addAll (config .getIoExceptionFilters ());
648
700
701
+ // tuning
702
+ tcpNoDelay = config .isTcpNoDelay ();
703
+ soReuseAddress = config .isSoReuseAddress ();
704
+ soLinger = config .getSoLinger ();
705
+ soSndBuf = config .getSoSndBuf ();
706
+ soRcvBuf = config .getSoRcvBuf ();
707
+
649
708
// internals
650
709
threadPoolName = config .getThreadPoolName ();
651
710
httpClientCodecMaxInitialLineLength = config .getHttpClientCodecMaxInitialLineLength ();
@@ -890,6 +949,32 @@ public Builder removeIOExceptionFilter(IOExceptionFilter ioExceptionFilter) {
890
949
return this ;
891
950
}
892
951
952
+ // tuning
953
+ public Builder setTcpNoDelay (boolean tcpNoDelay ) {
954
+ this .tcpNoDelay = tcpNoDelay ;
955
+ return this ;
956
+ }
957
+
958
+ public Builder setSoReuseAddress (boolean soReuseAddress ) {
959
+ this .soReuseAddress = soReuseAddress ;
960
+ return this ;
961
+ }
962
+
963
+ public Builder setSoLinger (int soLinger ) {
964
+ this .soLinger = soLinger ;
965
+ return this ;
966
+ }
967
+
968
+ public Builder setSoSndBuf (int soSndBuf ) {
969
+ this .soSndBuf = soSndBuf ;
970
+ return this ;
971
+ }
972
+
973
+ public Builder setSoRcvBuf (int soRcvBuf ) {
974
+ this .soRcvBuf = soRcvBuf ;
975
+ return this ;
976
+ }
977
+
893
978
// internals
894
979
public Builder setThreadPoolName (String threadPoolName ) {
895
980
this .threadPoolName = threadPoolName ;
@@ -1024,6 +1109,11 @@ public DefaultAsyncHttpClientConfig build() {
1024
1109
requestFilters .isEmpty () ? Collections .emptyList () : Collections .unmodifiableList (requestFilters ), //
1025
1110
responseFilters .isEmpty () ? Collections .emptyList () : Collections .unmodifiableList (responseFilters ),//
1026
1111
ioExceptionFilters .isEmpty () ? Collections .emptyList () : Collections .unmodifiableList (ioExceptionFilters ),//
1112
+ tcpNoDelay , //
1113
+ soReuseAddress , //
1114
+ soLinger , //
1115
+ soSndBuf , //
1116
+ soRcvBuf , //
1027
1117
threadPoolName , //
1028
1118
httpClientCodecMaxInitialLineLength , //
1029
1119
httpClientCodecMaxHeaderSize , //
0 commit comments