Skip to content

Commit f2acf0d

Browse files
rccarpermillems
authored andcommitted
Adding manual window management flag
1 parent 185c395 commit f2acf0d

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

http-clients/aws-crt-client/src/main/java/software/amazon/awssdk/http/crt/AwsCrtAsyncHttpClient.java

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public class AwsCrtAsyncHttpClient implements SdkAsyncHttpClient {
7777
private final TlsContext tlsContext;
7878
private final int windowSize;
7979
private final int maxConnectionsPerEndpoint;
80-
80+
private final boolean manualWindowManagement;
8181

8282
public AwsCrtAsyncHttpClient(DefaultBuilder builder, AttributeMap config) {
8383
int maxConns = config.get(SdkHttpConfigurationOption.MAX_CONNECTIONS);
@@ -111,6 +111,7 @@ public AwsCrtAsyncHttpClient(DefaultBuilder builder, AttributeMap config) {
111111
this.tlsContext = own(new TlsContext(this.tlsContextOptions));
112112
this.windowSize = builder.windowSize;
113113
this.maxConnectionsPerEndpoint = maxConns;
114+
this.manualWindowManagement = builder.manualWindowManagement;
114115
}
115116

116117
/**
@@ -151,7 +152,8 @@ private HttpClientConnectionManager createConnectionPool(URI uri) {
151152
.withTlsContext(tlsContext)
152153
.withUri(uri)
153154
.withWindowSize(windowSize)
154-
.withMaxConnections(maxConnectionsPerEndpoint);
155+
.withMaxConnections(maxConnectionsPerEndpoint)
156+
.withManualWindowManagement(manualWindowManagement);
155157

156158
return HttpClientConnectionManager.create(options);
157159
}
@@ -293,6 +295,13 @@ public interface Builder extends SdkAsyncHttpClient.Builder<AwsCrtAsyncHttpClien
293295
*/
294296
Builder verifyPeer(boolean verifyPeer);
295297

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+
296305
/**
297306
* The AWS CRT WindowSize to use for this HttpClient. This represents the number of unread bytes that can be
298307
* 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 {
327336
private TlsCipherPreference cipherPreference = TlsCipherPreference.TLS_CIPHER_SYSTEM_DEFAULT;
328337
private int windowSize = DEFAULT_STREAM_WINDOW_SIZE;
329338
private boolean verifyPeer = true;
339+
private boolean manualWindowManagement;
330340
private EventLoopGroup eventLoopGroup;
331341
private HostResolver hostResolver;
332342

@@ -361,6 +371,12 @@ public Builder verifyPeer(boolean verifyPeer) {
361371
return this;
362372
}
363373

374+
@Override
375+
public Builder manualWindowManagement(boolean manualWindowManagement) {
376+
this.manualWindowManagement = manualWindowManagement;
377+
return this;
378+
}
379+
364380
@Override
365381
public Builder windowSize(int windowSize) {
366382
Validate.isPositive(windowSize, "windowSize");

http-clients/aws-crt-client/src/test/java/software/amazon/awssdk/http/crt/AwsCrtHttpClientSpiVerificationTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ public void setup() throws Exception {
8181
client = AwsCrtAsyncHttpClient.builder()
8282
.eventLoopGroup(eventLoopGroup)
8383
.hostResolver(hostResolver)
84+
.manualWindowManagement(true)
8485
.build();
8586
}
8687

0 commit comments

Comments
 (0)