@@ -76,7 +76,7 @@ public final class AwsCrtAsyncHttpClient implements SdkAsyncHttpClient {
76
76
private static final Logger log = Logger .loggerFor (AwsCrtAsyncHttpClient .class );
77
77
78
78
private static final String AWS_COMMON_RUNTIME = "AwsCommonRuntime" ;
79
- private static final int DEFAULT_STREAM_WINDOW_SIZE = 16 * 1024 * 1024 ; // 16 MB
79
+ private static final long DEFAULT_STREAM_WINDOW_SIZE = 16L * 1024L * 1024L ; // 16 MB
80
80
81
81
private final Map <URI , HttpClientConnectionManager > connectionPools = new ConcurrentHashMap <>();
82
82
private final LinkedList <CrtResource > ownedSubResources = new LinkedList <>();
@@ -86,7 +86,7 @@ public final class AwsCrtAsyncHttpClient implements SdkAsyncHttpClient {
86
86
private final HttpProxyOptions proxyOptions ;
87
87
private final HttpMonitoringOptions monitoringOptions ;
88
88
private final long maxConnectionIdleInMilliseconds ;
89
- private final int readBufferSize ;
89
+ private final long readBufferSize ;
90
90
private final int maxConnectionsPerEndpoint ;
91
91
private boolean isClosed = false ;
92
92
@@ -107,7 +107,7 @@ private AwsCrtAsyncHttpClient(DefaultBuilder builder, AttributeMap config) {
107
107
this .bootstrap = registerOwnedResource (clientBootstrap );
108
108
this .socketOptions = registerOwnedResource (clientSocketOptions );
109
109
this .tlsContext = registerOwnedResource (clientTlsContext );
110
- this .readBufferSize = builder .readBufferSize == null ? DEFAULT_STREAM_WINDOW_SIZE : builder .readBufferSize ;
110
+ this .readBufferSize = builder .readBufferSize == null ? DEFAULT_STREAM_WINDOW_SIZE : builder .readBufferSize ;
111
111
this .maxConnectionsPerEndpoint = config .get (SdkHttpConfigurationOption .MAX_CONNECTIONS );
112
112
this .monitoringOptions = revolveHttpMonitoringOptions (builder .connectionHealthConfiguration );
113
113
this .maxConnectionIdleInMilliseconds = config .get (SdkHttpConfigurationOption .CONNECTION_MAX_IDLE_TIMEOUT ).toMillis ();
@@ -213,7 +213,7 @@ private HttpClientConnectionManager createConnectionPool(URI uri) {
213
213
.withSocketOptions (socketOptions )
214
214
.withTlsContext (tlsContext )
215
215
.withUri (uri )
216
- .withWindowSize (readBufferSize )
216
+ .withWindowSize (NumericUtils . saturatedCast ( readBufferSize ) )
217
217
.withMaxConnections (maxConnectionsPerEndpoint )
218
218
.withManualWindowManagement (true )
219
219
.withProxyOptions (proxyOptions )
@@ -326,12 +326,11 @@ public interface Builder extends SdkAsyncHttpClient.Builder<AwsCrtAsyncHttpClien
326
326
* client before we stop reading from the underlying TCP socket and wait for the Subscriber
327
327
* to read more data.
328
328
*
329
- * @param readBufferSize The number of bytes that can be buffered
329
+ * @param readBufferSize The number of bytes that can be buffered. The maximum buffering size value is
330
+ * capped at {@code Integer.MAX}.
330
331
* @return The builder of the method chaining.
331
- *
332
- * TODO: This is also used for the write buffer size. Should we rename it?
333
332
*/
334
- Builder readBufferSizeInBytes (Integer readBufferSize );
333
+ Builder readBufferSizeInBytes (Long readBufferSize );
335
334
336
335
/**
337
336
* Sets the http proxy configuration to use for this client.
@@ -427,7 +426,7 @@ Builder tcpKeepAliveConfiguration(Consumer<TcpKeepAliveConfiguration.Builder>
427
426
*/
428
427
private static final class DefaultBuilder implements Builder {
429
428
private final AttributeMap .Builder standardOptions = AttributeMap .builder ();
430
- private Integer readBufferSize ;
429
+ private Long readBufferSize ;
431
430
private ProxyConfiguration proxyConfiguration ;
432
431
private ConnectionHealthConfiguration connectionHealthConfiguration ;
433
432
private TcpKeepAliveConfiguration tcpKeepAliveConfiguration ;
@@ -456,7 +455,7 @@ public Builder maxConcurrency(Integer maxConcurrency) {
456
455
}
457
456
458
457
@ Override
459
- public Builder readBufferSizeInBytes (Integer readBufferSize ) {
458
+ public Builder readBufferSizeInBytes (Long readBufferSize ) {
460
459
Validate .isPositiveOrNull (readBufferSize , "readBufferSize" );
461
460
this .readBufferSize = readBufferSize ;
462
461
return this ;
0 commit comments