@@ -77,7 +77,7 @@ public class AwsCrtAsyncHttpClient implements SdkAsyncHttpClient {
77
77
private final TlsContext tlsContext ;
78
78
private final int windowSize ;
79
79
private final int maxConnectionsPerEndpoint ;
80
-
80
+ private final boolean manualWindowManagement ;
81
81
82
82
public AwsCrtAsyncHttpClient (DefaultBuilder builder , AttributeMap config ) {
83
83
int maxConns = config .get (SdkHttpConfigurationOption .MAX_CONNECTIONS );
@@ -111,6 +111,7 @@ public AwsCrtAsyncHttpClient(DefaultBuilder builder, AttributeMap config) {
111
111
this .tlsContext = own (new TlsContext (this .tlsContextOptions ));
112
112
this .windowSize = builder .windowSize ;
113
113
this .maxConnectionsPerEndpoint = maxConns ;
114
+ this .manualWindowManagement = builder .manualWindowManagement ;
114
115
}
115
116
116
117
/**
@@ -151,7 +152,8 @@ private HttpClientConnectionManager createConnectionPool(URI uri) {
151
152
.withTlsContext (tlsContext )
152
153
.withUri (uri )
153
154
.withWindowSize (windowSize )
154
- .withMaxConnections (maxConnectionsPerEndpoint );
155
+ .withMaxConnections (maxConnectionsPerEndpoint )
156
+ .withManualWindowManagement (manualWindowManagement );
155
157
156
158
return HttpClientConnectionManager .create (options );
157
159
}
@@ -293,6 +295,13 @@ public interface Builder extends SdkAsyncHttpClient.Builder<AwsCrtAsyncHttpClien
293
295
*/
294
296
Builder verifyPeer (boolean verifyPeer );
295
297
298
+ /**
299
+ * If set to true, then the TCP read back pressure mechanism will be enabled.
300
+ * @param manualWindowManagement true if the TCP back pressure mechanism should be enabled.
301
+ * @return The builder of the method chaining.
302
+ */
303
+ Builder manualWindowManagement (boolean manualWindowManagement );
304
+
296
305
/**
297
306
* The AWS CRT WindowSize to use for this HttpClient. This represents the number of unread bytes that can be
298
307
* buffered in the ResponseBodyPublisher before we stop reading from the underlying TCP socket and wait for
@@ -327,6 +336,7 @@ private static final class DefaultBuilder implements Builder {
327
336
private TlsCipherPreference cipherPreference = TlsCipherPreference .TLS_CIPHER_SYSTEM_DEFAULT ;
328
337
private int windowSize = DEFAULT_STREAM_WINDOW_SIZE ;
329
338
private boolean verifyPeer = true ;
339
+ private boolean manualWindowManagement ;
330
340
private EventLoopGroup eventLoopGroup ;
331
341
private HostResolver hostResolver ;
332
342
@@ -361,6 +371,12 @@ public Builder verifyPeer(boolean verifyPeer) {
361
371
return this ;
362
372
}
363
373
374
+ @ Override
375
+ public Builder manualWindowManagement (boolean manualWindowManagement ) {
376
+ this .manualWindowManagement = manualWindowManagement ;
377
+ return this ;
378
+ }
379
+
364
380
@ Override
365
381
public Builder windowSize (int windowSize ) {
366
382
Validate .isPositive (windowSize , "windowSize" );
0 commit comments