Skip to content

Commit

Permalink
change added back
Browse files Browse the repository at this point in the history
  • Loading branch information
Fred1155 committed Jan 30, 2025
1 parent 65e9f94 commit dc7c2fe
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,13 @@ AwsCrtAsyncHttpClient.Builder connectionHealthConfiguration(Consumer<ConnectionH
*/
AwsCrtAsyncHttpClient.Builder connectionTimeout(Duration connectionTimeout);

/**
* The amount of time to wait when acquiring a connection from the pool before giving up and timing out.
* @param connectionAcquisitionTimeout the timeout duration
* @return this builder for method chaining.
*/
AwsCrtAsyncHttpClient.Builder connectionAcquisitionTimeout(Duration connectionAcquisitionTimeout);

/**
* Configure whether to enable {@code tcpKeepAlive} and relevant configuration for all connections established by this
* client.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,13 @@ AwsCrtHttpClient.Builder connectionHealthConfiguration(Consumer<ConnectionHealth
*/
AwsCrtHttpClient.Builder connectionTimeout(Duration connectionTimeout);

/**
* The amount of time to wait when acquiring a connection from the pool before giving up and timing out.
* @param connectionAcquisitionTimeout the timeout duration
* @return this builder for method chaining.
*/
AwsCrtHttpClient.Builder connectionAcquisitionTimeout(Duration connectionAcquisitionTimeout);

/**
* Configure whether to enable {@code tcpKeepAlive} and relevant configuration for all connections established by this
* client.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ abstract class AwsCrtHttpClientBase implements SdkAutoCloseable {
private final HttpMonitoringOptions monitoringOptions;
private final long maxConnectionIdleInMilliseconds;
private final int maxConnectionsPerEndpoint;
private final long connectionAcquisitionTimeout;
private boolean isClosed = false;

AwsCrtHttpClientBase(AwsCrtClientBuilderBase builder, AttributeMap config) {
Expand All @@ -90,6 +91,7 @@ abstract class AwsCrtHttpClientBase implements SdkAutoCloseable {
this.maxConnectionsPerEndpoint = config.get(SdkHttpConfigurationOption.MAX_CONNECTIONS);
this.monitoringOptions = resolveHttpMonitoringOptions(builder.getConnectionHealthConfiguration()).orElse(null);
this.maxConnectionIdleInMilliseconds = config.get(SdkHttpConfigurationOption.CONNECTION_MAX_IDLE_TIMEOUT).toMillis();
this.connectionAcquisitionTimeout = config.get(SdkHttpConfigurationOption.CONNECTION_ACQUIRE_TIMEOUT).toMillis();
this.proxyOptions = resolveProxy(builder.getProxyConfiguration(), tlsContext).orElse(null);
}
}
Expand Down Expand Up @@ -126,7 +128,8 @@ private HttpClientConnectionManager createConnectionPool(URI uri) {
.withManualWindowManagement(true)
.withProxyOptions(proxyOptions)
.withMonitoringOptions(monitoringOptions)
.withMaxConnectionIdleInMilliseconds(maxConnectionIdleInMilliseconds);
.withMaxConnectionIdleInMilliseconds(maxConnectionIdleInMilliseconds)
.withConnectionAcquisitionTimeoutInMilliseconds(connectionAcquisitionTimeout);

return HttpClientConnectionManager.create(options);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ public BuilderT connectionTimeout(Duration connectionTimeout) {
return thisBuilder();
}

public BuilderT connectionAcquisitionTimeout(Duration connectionAcquisitionTimeout) {
Validate.isPositive(connectionAcquisitionTimeout, "connectionAcquisitionTimeout");
standardOptions.put(SdkHttpConfigurationOption.CONNECTION_ACQUIRE_TIMEOUT, connectionAcquisitionTimeout);
return thisBuilder();
}

public BuilderT tcpKeepAliveConfiguration(TcpKeepAliveConfiguration tcpKeepAliveConfiguration) {
this.tcpKeepAliveConfiguration = tcpKeepAliveConfiguration;
return thisBuilder();
Expand Down

0 comments on commit dc7c2fe

Please sign in to comment.