Skip to content

Commit 23fe873

Browse files
committed
Address PR comments
1 parent 84d63fc commit 23fe873

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

core/aws-core/src/main/java/software/amazon/awssdk/awscore/client/builder/AwsDefaultClientBuilder.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515

1616
package software.amazon.awssdk.awscore.client.builder;
1717

18+
import static software.amazon.awssdk.core.client.config.SdkClientOption.CONFIGURED_RETRY_CONFIGURATOR;
19+
import static software.amazon.awssdk.core.client.config.SdkClientOption.CONFIGURED_RETRY_MODE;
20+
import static software.amazon.awssdk.core.client.config.SdkClientOption.CONFIGURED_RETRY_STRATEGY;
1821
import static software.amazon.awssdk.core.client.config.SdkClientOption.RETRY_STRATEGY;
1922

2023
import java.net.URI;
@@ -197,8 +200,7 @@ protected final SdkClientConfiguration setOverrides(SdkClientConfiguration confi
197200
if (overrideConfig == null) {
198201
return configuration;
199202
}
200-
SdkClientConfiguration.Builder builder = configuration.toBuilder()
201-
.putAll(overrideConfig);
203+
SdkClientConfiguration.Builder builder = configuration.toBuilder();
202204
overrideConfig.retryStrategy().ifPresent(retryStrategy -> builder.option(RETRY_STRATEGY, retryStrategy));
203205
overrideConfig.retryMode().ifPresent(retryMode -> builder.option(RETRY_STRATEGY,
204206
AwsRetryStrategy.forRetryMode(retryMode)));
@@ -207,6 +209,11 @@ protected final SdkClientConfiguration setOverrides(SdkClientConfiguration confi
207209
configurator.accept(defaultBuilder);
208210
builder.option(RETRY_STRATEGY, defaultBuilder.build());
209211
});
212+
builder.putAll(overrideConfig)
213+
// Forget anything we configured in the override configuration else it might be re-applied.
214+
builder.option(CONFIGURED_RETRY_MODE, null);
215+
builder.option(CONFIGURED_RETRY_STRATEGY, null);
216+
builder.option(CONFIGURED_RETRY_CONFIGURATOR, null);
210217
return builder.build();
211218
}
212219

core/sdk-core/src/main/java/software/amazon/awssdk/core/client/config/ClientOverrideConfiguration.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,12 +486,17 @@ default Builder retryPolicy(RetryMode retryMode) {
486486

487487
/**
488488
* Configure the retry strategy that should be used when handling failure cases.
489+
*
490+
* <p>
491+
* Note that retryStrategy options are mutually exclusive
489492
*/
490493
Builder retryStrategy(RetryStrategy retryStrategy);
491494

492495
/**
493496
* Configure the retry mode used to resolve the corresponding {@link RetryStrategy} that should be used when handling
494497
* failure cases.
498+
* <p>
499+
* Note that retryStrategy options are mutually exclusive
495500
*
496501
* @see RetryMode
497502
*/
@@ -511,6 +516,8 @@ default Builder retryStrategy(RetryMode retryMode) {
511516
*
512517
* <p>
513518
* Defaults to {@link RetryMode#LEGACY} if no configuration setting is found.
519+
* <p>
520+
* Note that retryStrategy options are mutually exclusive
514521
*/
515522
default Builder retryStrategy(Consumer<RetryStrategy.Builder<?, ?>> configurator) {
516523
throw new UnsupportedOperationException();

0 commit comments

Comments
 (0)