15
15
16
16
package software .amazon .awssdk .awscore .client .builder ;
17
17
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 ;
18
21
import static software .amazon .awssdk .core .client .config .SdkClientOption .RETRY_STRATEGY ;
19
22
20
23
import java .net .URI ;
@@ -197,8 +200,7 @@ protected final SdkClientConfiguration setOverrides(SdkClientConfiguration confi
197
200
if (overrideConfig == null ) {
198
201
return configuration ;
199
202
}
200
- SdkClientConfiguration .Builder builder = configuration .toBuilder ()
201
- .putAll (overrideConfig );
203
+ SdkClientConfiguration .Builder builder = configuration .toBuilder ();
202
204
overrideConfig .retryStrategy ().ifPresent (retryStrategy -> builder .option (RETRY_STRATEGY , retryStrategy ));
203
205
overrideConfig .retryMode ().ifPresent (retryMode -> builder .option (RETRY_STRATEGY ,
204
206
AwsRetryStrategy .forRetryMode (retryMode )));
@@ -207,6 +209,11 @@ protected final SdkClientConfiguration setOverrides(SdkClientConfiguration confi
207
209
configurator .accept (defaultBuilder );
208
210
builder .option (RETRY_STRATEGY , defaultBuilder .build ());
209
211
});
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 );
210
217
return builder .build ();
211
218
}
212
219
0 commit comments