Skip to content

Commit b8f136c

Browse files
sugmanuejoviegas
andauthored
Merge retries (#5283)
* New API for the retries module (#3769) This new module includes the interfaces and classes that will be used to implement the new retry logic within the SDK. * Add default backoff strategies (#3906) * Add default backoff strategies * Moved the backoff strategires to the SPI package * Use AssertJ instead of Hamcrest * Add standard retry strategy (#3931) * Add standard retry strategy * Fix the AcquireInitialTokenRequestImpl API annotation Also add the package to the test/tests-coverage-reporting/pom.xml to get coverage reporting * Add adaptive retry strategy (#3975) * Add adaptive retry strategy * Address pull request comments * Address PR comments * Address PR comments * Update retries and retries-api to snapshot version: 2.20.64-SNAPSHOT * Fix SonarCloud code smells (#3991) * Fix SonarCloud code smells * Move AdaptiveRetryStrategyResourceConstrainedTest to an integration test This change is to workaround the SonarCloud code smell of the Sleep usage in this test * Add legacy retry strategy (#3988) * Add legacy retry strategy * Remove public modifiers from test classes to make SonarCloud happy * Fix another SonarCloud code smell * WIP * Address PR comments * Rename all the strategies to use Default prefix instead of Impl suffix * Address PR comments * Remove those tests that are now part of a different class * Update version after merge from master * Refactor retry strategies (#4039) * Refactor the retry strategies This change uses a single class to implement the core logic of all the retries strategies and adds extension points to tailor the behavior when needed. * Rename to BaseRetryStrategy and make it abstract * Remove previous implementations and rename the new ones * Update sdk version * Fix the retry condition to just look for the initial cause * Add new sync and async retryable stages (#4062) * Add new sync and async retryable stages * Address PR comments * Update sdk version * Change uses of RetryPolicy to RetryStrategy (#4125) * Update sdk version * Deprecate legacy classes and use new when possible (#4154) * Deprecate legacy classes and use new when possible * Fix checkstyle and add some more validation * Add missing @deprecated annotation * Add missing dependency to the retries-api module * Fix minor logging issues * Update sdk version * Add support for retryable trait (#4170) * Merge master * Update to support plugins * Add support for AWS retryable conditions * Use the correct token bucket exception cost value * Add ADAPTIVE_V2 retry mode to support the legacy behavior (#5123) * Add a new ADAPTIVE2 mode to support the legacy behavior * Fix dynamodb test to use adaptive2 mode * Fixes and tests for the expected behaviors * Rename the new adaptive mode to ADAPTIVE_V2 * More fixes related to the rename from adaptive2 to adaptive_v2 * Fix dynamodb retry resolver logic for adaptive mode * Properly clean up the test state * Address PR comments * Remove a small typo * Dumy commit * Dummy commit to kick the internal build * Rename retries-api to retries-spi * Add retry packages to brazil (#5215) * Add retry packages to brazil * Update pom's as per the new module checklist * Remove type params from RetryStrategy, but keep them in RetryStrategy… (#5262) * Remove type params from RetryStrategy, but keep them in RetryStrategy.Builder * Rename from `none` to `doNotRetry` to clarify the behavior * External names used for retry modes only support 'adaptive' (#5265) * Externally named retry modes only support 'adaptive' Behind the scenes this will be mapped to RetryMode.ADAPTIVE_V2 which makes it a non-backwards compatible behavioral change. * Sneak in a fix from the previous PR * Fix a test that expects adaptive to map to `RetryMode.ADAPTIVE` * Fix typos in the comments * Retries release (#5280) * Bump version to 2.26.0-SNAPSHOT * Add retry release changlog entry * Add missing deprecation annotation and javadoc tag * Archive the last changelog from the 2.25 series --------- Co-authored-by: John Viegas <[email protected]>
1 parent bef4dd8 commit b8f136c

File tree

692 files changed

+9181
-737
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

692 files changed

+9181
-737
lines changed

.brazil.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@
4141
"http-auth-aws": { "packageName": "AwsJavaSdk-Core-HttpAuthAws" },
4242
"http-auth-aws-crt": { "packageName": "AwsJavaSdk-Core-HttpAuthAwsCrt" },
4343
"http-auth-aws-eventstream": { "packageName": "AwsJavaSdk-Core-HttpAuthAwsEventStream" },
44+
"retries-spi": { "packageName": "AwsJavaSdk-Core-RetriesSpi" },
45+
"retries": { "packageName": "AwsJavaSdk-Core-Retries" },
4446

4547
"dynamodb": { "packageName": "AwsJavaSdk-DynamoDb" },
4648
"waf": { "packageName": "AwsJavaSdk-Waf" },
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"type": "bugfix",
3+
"category": "AWS SDK for Java v2",
4+
"contributor": "",
5+
"description": "Fixed an issue in async client where the future would get stuck if there is a server error and the server fails to return response body that matches with the content length specified in the response header. See [#4354](https://github.com/aws/aws-sdk-java-v2/issues/4354)"
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"category": "\"AWS SDK for Java v2\"",
3+
"contributor": "sugmanue",
4+
"type": "feature",
5+
"description": "This release contains a major internal refactor of retries and is part\nof moving the SDK to a standardized AWS SDK architecture. It\nintroduces the interface `RetryStrategy` and three subclasses\n`StandardRetryStrategy`, `LegacyRetryStrategy` , and\n`AdaptiveRetryStrategy`. The new interfaces live in the `retry-spi`\nmodule, and the implementation classes live in the `retries` module.\n\nNote 1) This change marks RetryPolicy as as deprecated and we\nencourage users to migrate to its replacement, RetryStrategy. However,\nretry policies are, and will for the foreseeable future be fully\nsupported. Clients configured to use retry policies will not need any\ncode changes and won\u2019t see any behavioral change with this release.\n\nNote 2) The original implementation of adaptive mode (see\n[#2658](https://github.com/aws/aws-sdk-java-v2/pull/2658)) that was\nreleased with the retry policy API contains a bug in its rate-limiter\nlogic which prevents it from remembering state across requests. In\nthis release of the retry strategy API, we introduce\n`RetryMode.ADAPTIVE_V2`, which implements the correct adaptive\nbehavior. `RetryMode.ADAPTIVE` is still present in order to maintain\nbackwards compatibility, but is now marked as deprecated.\n\nNote 3) When configuring retry mode through system settings or\nenvironment variables, users can only choose adaptive mode. This\nsetting will map to `RetryMode.ADAPTIVE_V2` instead of\n`RetryMode.ADAPTIVE` with this release, giving users the correct\nbehavior and still keeping the settings consistent across all\nSDKs. The list of configuration options are: profile file `retry_mode`\nsetting, the `aws.retryMode` system property and the `AWS_RETRY_MODE`\nenvironment variable."
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"category": "AWS SDK for Java v2",
3+
"contributor": "sugmanue",
4+
"type": "feature",
5+
"description": "Adds the new module retries API module"
6+
}

archetypes/archetype-app-quickstart/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<parent>
2121
<artifactId>archetypes</artifactId>
2222
<groupId>software.amazon.awssdk</groupId>
23-
<version>2.25.71-SNAPSHOT</version>
23+
<version>2.26.0-SNAPSHOT</version>
2424
</parent>
2525
<modelVersion>4.0.0</modelVersion>
2626

archetypes/archetype-lambda/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<parent>
2121
<artifactId>archetypes</artifactId>
2222
<groupId>software.amazon.awssdk</groupId>
23-
<version>2.25.71-SNAPSHOT</version>
23+
<version>2.26.0-SNAPSHOT</version>
2424
</parent>
2525
<modelVersion>4.0.0</modelVersion>
2626
<artifactId>archetype-lambda</artifactId>

archetypes/archetype-tools/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<parent>
2121
<artifactId>archetypes</artifactId>
2222
<groupId>software.amazon.awssdk</groupId>
23-
<version>2.25.71-SNAPSHOT</version>
23+
<version>2.26.0-SNAPSHOT</version>
2424
</parent>
2525
<modelVersion>4.0.0</modelVersion>
2626

archetypes/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<parent>
2121
<artifactId>aws-sdk-java-pom</artifactId>
2222
<groupId>software.amazon.awssdk</groupId>
23-
<version>2.25.71-SNAPSHOT</version>
23+
<version>2.26.0-SNAPSHOT</version>
2424
</parent>
2525
<modelVersion>4.0.0</modelVersion>
2626
<artifactId>archetypes</artifactId>

aws-sdk-java/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<parent>
1818
<groupId>software.amazon.awssdk</groupId>
1919
<artifactId>aws-sdk-java-pom</artifactId>
20-
<version>2.25.71-SNAPSHOT</version>
20+
<version>2.26.0-SNAPSHOT</version>
2121
<relativePath>../pom.xml</relativePath>
2222
</parent>
2323
<artifactId>aws-sdk-java</artifactId>

bom-internal/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<parent>
2121
<artifactId>aws-sdk-java-pom</artifactId>
2222
<groupId>software.amazon.awssdk</groupId>
23-
<version>2.25.71-SNAPSHOT</version>
23+
<version>2.26.0-SNAPSHOT</version>
2424
</parent>
2525
<modelVersion>4.0.0</modelVersion>
2626

bom/pom.xml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<parent>
1818
<groupId>software.amazon.awssdk</groupId>
1919
<artifactId>aws-sdk-java-pom</artifactId>
20-
<version>2.25.71-SNAPSHOT</version>
20+
<version>2.26.0-SNAPSHOT</version>
2121
<relativePath>../pom.xml</relativePath>
2222
</parent>
2323
<artifactId>bom</artifactId>
@@ -172,6 +172,16 @@
172172
<artifactId>http-client-spi</artifactId>
173173
<version>${awsjavasdk.version}</version>
174174
</dependency>
175+
<dependency>
176+
<groupId>software.amazon.awssdk</groupId>
177+
<artifactId>retries</artifactId>
178+
<version>${awsjavasdk.version}</version>
179+
</dependency>
180+
<dependency>
181+
<groupId>software.amazon.awssdk</groupId>
182+
<artifactId>retries-spi</artifactId>
183+
<version>${awsjavasdk.version}</version>
184+
</dependency>
175185
<dependency>
176186
<groupId>software.amazon.awssdk</groupId>
177187
<artifactId>apache-client</artifactId>

build-tools/src/main/java/software/amazon/awssdk/buildtools/findbugs/ToBuilderIsCorrect.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,11 +212,15 @@ public void visit(Method method) {
212212
}
213213
} else if (isBuildable && method.getName().equals("toBuilder") && method.getSignature().startsWith("()")) {
214214
// This is a buildable toBuilder
215-
constructorsInvokedFromToBuilder.computeIfAbsent(getDottedClassName(), n -> new HashMap<>());
216-
toBuilderModifiedFields.computeIfAbsent(getDottedClassName(), n -> new HashMap<>());
215+
String dottedClassName = getDottedClassName();
216+
constructorsInvokedFromToBuilder.computeIfAbsent(dottedClassName, n -> new HashMap<>());
217+
toBuilderModifiedFields.computeIfAbsent(dottedClassName, n -> new HashMap<>());
217218
inBuildableToBuilder = true;
218219
inBuilderConstructor = false;
219-
220+
if (method.isAbstract()) {
221+
// Ignore abstract toBuilder methods, we will still validate the actual implementations.
222+
ignoredBuildables.add(dottedClassName);
223+
}
220224
registerIgnoredFields();
221225
} else {
222226
inBuildableToBuilder = false;

bundle-logging-bridge/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<parent>
2222
<groupId>software.amazon.awssdk</groupId>
2323
<artifactId>aws-sdk-java-pom</artifactId>
24-
<version>2.25.71-SNAPSHOT</version>
24+
<version>2.26.0-SNAPSHOT</version>
2525
</parent>
2626
<artifactId>bundle-logging-bridge</artifactId>
2727
<packaging>jar</packaging>

bundle-sdk/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<parent>
2222
<groupId>software.amazon.awssdk</groupId>
2323
<artifactId>aws-sdk-java-pom</artifactId>
24-
<version>2.25.71-SNAPSHOT</version>
24+
<version>2.26.0-SNAPSHOT</version>
2525
</parent>
2626
<artifactId>bundle-sdk</artifactId>
2727
<packaging>jar</packaging>

bundle/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<parent>
2222
<groupId>software.amazon.awssdk</groupId>
2323
<artifactId>aws-sdk-java-pom</artifactId>
24-
<version>2.25.71-SNAPSHOT</version>
24+
<version>2.26.0-SNAPSHOT</version>
2525
</parent>
2626
<artifactId>bundle</artifactId>
2727
<packaging>jar</packaging>

codegen-lite-maven-plugin/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<parent>
2323
<groupId>software.amazon.awssdk</groupId>
2424
<artifactId>aws-sdk-java-pom</artifactId>
25-
<version>2.25.71-SNAPSHOT</version>
25+
<version>2.26.0-SNAPSHOT</version>
2626
<relativePath>../pom.xml</relativePath>
2727
</parent>
2828
<artifactId>codegen-lite-maven-plugin</artifactId>

codegen-lite/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<parent>
2222
<groupId>software.amazon.awssdk</groupId>
2323
<artifactId>aws-sdk-java-pom</artifactId>
24-
<version>2.25.71-SNAPSHOT</version>
24+
<version>2.26.0-SNAPSHOT</version>
2525
</parent>
2626
<artifactId>codegen-lite</artifactId>
2727
<name>AWS Java SDK :: Code Generator Lite</name>

codegen-maven-plugin/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<parent>
2323
<groupId>software.amazon.awssdk</groupId>
2424
<artifactId>aws-sdk-java-pom</artifactId>
25-
<version>2.25.71-SNAPSHOT</version>
25+
<version>2.26.0-SNAPSHOT</version>
2626
<relativePath>../pom.xml</relativePath>
2727
</parent>
2828
<artifactId>codegen-maven-plugin</artifactId>

codegen/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<parent>
2222
<groupId>software.amazon.awssdk</groupId>
2323
<artifactId>aws-sdk-java-pom</artifactId>
24-
<version>2.25.71-SNAPSHOT</version>
24+
<version>2.26.0-SNAPSHOT</version>
2525
</parent>
2626
<artifactId>codegen</artifactId>
2727
<name>AWS Java SDK :: Code Generator</name>

codegen/src/main/java/software/amazon/awssdk/codegen/AddExceptionShapes.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@ private Map<String, ShapeModel> constructExceptionShapes() {
4444
// Java shape models, to be constructed
4545
Map<String, ShapeModel> javaShapes = new HashMap<>();
4646

47-
for (Map.Entry<String, Shape> shape : getServiceModel().getShapes().entrySet()) {
48-
if (shape.getValue().isException()) {
49-
String errorShapeName = shape.getKey();
47+
for (Map.Entry<String, Shape> kvp : getServiceModel().getShapes().entrySet()) {
48+
if (kvp.getValue().isException()) {
49+
Shape shape = kvp.getValue();
50+
String errorShapeName = kvp.getKey();
5051
String javaClassName = getNamingStrategy().getExceptionName(errorShapeName);
5152

5253
ShapeModel exceptionShapeModel = generateShapeModel(javaClassName,
@@ -55,8 +56,10 @@ private Map<String, ShapeModel> constructExceptionShapes() {
5556
exceptionShapeModel.setType(ShapeType.Exception.getValue());
5657
exceptionShapeModel.setErrorCode(getErrorCode(errorShapeName));
5758
exceptionShapeModel.setHttpStatusCode(getHttpStatusCode(errorShapeName));
59+
exceptionShapeModel.withIsRetryable(shape.isRetryable());
60+
exceptionShapeModel.withIsThrottling(shape.isThrottling());
5861
if (exceptionShapeModel.getDocumentation() == null) {
59-
exceptionShapeModel.setDocumentation(shape.getValue().getDocumentation());
62+
exceptionShapeModel.setDocumentation(shape.getDocumentation());
6063
}
6164

6265
javaShapes.put(javaClassName, exceptionShapeModel);

codegen/src/main/java/software/amazon/awssdk/codegen/AddShapes.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ protected final ShapeModel generateShapeModel(String javaClassName, String shape
8787
shapeModel.withXmlNamespace(shape.getXmlNamespace());
8888
shapeModel.withIsUnion(shape.isUnion());
8989
shapeModel.withIsFault(shape.isFault());
90+
shapeModel.withIsRetryable(shape.isRetryable());
91+
shapeModel.withIsThrottling(shape.isThrottling());
9092

9193
boolean hasHeaderMember = false;
9294
boolean hasStatusCodeMember = false;

codegen/src/main/java/software/amazon/awssdk/codegen/model/config/customization/CustomizationConfig.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,11 @@ public class CustomizationConfig {
142142
*/
143143
private String customRetryPolicy;
144144

145+
/**
146+
* Custom Retry strategy
147+
*/
148+
private String customRetryStrategy;
149+
145150
private boolean skipSyncClientGeneration;
146151

147152
/**
@@ -533,10 +538,18 @@ public String getCustomRetryPolicy() {
533538
return customRetryPolicy;
534539
}
535540

541+
public String getCustomRetryStrategy() {
542+
return customRetryStrategy;
543+
}
544+
536545
public void setCustomRetryPolicy(String customRetryPolicy) {
537546
this.customRetryPolicy = customRetryPolicy;
538547
}
539548

549+
public void setCustomRetryStrategy(String customRetryStrategy) {
550+
this.customRetryStrategy = customRetryStrategy;
551+
}
552+
540553
public boolean isSkipSyncClientGeneration() {
541554
return skipSyncClientGeneration;
542555
}

codegen/src/main/java/software/amazon/awssdk/codegen/model/intermediate/IntermediateModel.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,10 @@ public String getCustomRetryPolicy() {
203203
return customizationConfig.getCustomRetryPolicy();
204204
}
205205

206+
public String getCustomRetryStrategy() {
207+
return customizationConfig.getCustomRetryStrategy();
208+
}
209+
206210
public String getSdkModeledExceptionBaseFqcn() {
207211
return String.format("%s.%s",
208212
metadata.getFullModelPackageName(),

codegen/src/main/java/software/amazon/awssdk/codegen/model/intermediate/ShapeModel.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ public class ShapeModel extends DocumentationModel implements HasDeprecation {
7575

7676
private boolean union;
7777

78+
private boolean retryable;
79+
private boolean throttling;
80+
7881
public ShapeModel() {
7982
}
8083

@@ -648,4 +651,22 @@ public ShapeModel withIsFault(boolean fault) {
648651
this.fault = fault;
649652
return this;
650653
}
654+
655+
public boolean isRetryable() {
656+
return retryable;
657+
}
658+
659+
public ShapeModel withIsRetryable(boolean retryable) {
660+
this.retryable = retryable;
661+
return this;
662+
}
663+
664+
public boolean isThrottling() {
665+
return throttling;
666+
}
667+
668+
public ShapeModel withIsThrottling(boolean throttling) {
669+
this.throttling = throttling;
670+
return this;
671+
}
651672
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License").
5+
* You may not use this file except in compliance with the License.
6+
* A copy of the License is located at
7+
*
8+
* http://aws.amazon.com/apache2.0
9+
*
10+
* or in the "license" file accompanying this file. This file is distributed
11+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12+
* express or implied. See the License for the specific language governing
13+
* permissions and limitations under the License.
14+
*/
15+
16+
package software.amazon.awssdk.codegen.model.service;
17+
18+
public class RetryableTrait {
19+
20+
private Boolean throttling;
21+
22+
public void setThrottling(boolean throttling) {
23+
this.throttling = throttling;
24+
}
25+
26+
public Boolean getThrottling() {
27+
return throttling;
28+
}
29+
30+
public boolean isThrottling() {
31+
return Boolean.TRUE.equals(throttling);
32+
}
33+
}

codegen/src/main/java/software/amazon/awssdk/codegen/model/service/Shape.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ public class Shape {
7878

7979
private boolean union;
8080

81+
private RetryableTrait retryable;
82+
8183
public boolean isFault() {
8284
return fault;
8385
}
@@ -345,4 +347,16 @@ public boolean isUnion() {
345347
public void setUnion(boolean union) {
346348
this.union = union;
347349
}
350+
351+
public void setRetryable(RetryableTrait retryable) {
352+
this.retryable = retryable;
353+
}
354+
355+
public boolean isRetryable() {
356+
return retryable != null;
357+
}
358+
359+
public boolean isThrottling() {
360+
return retryable != null && retryable.isThrottling();
361+
}
348362
}

codegen/src/main/java/software/amazon/awssdk/codegen/poet/builder/BaseClientBuilderClass.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,12 @@ private MethodSpec finalizeServiceConfigurationMethod() {
424424
PoetUtils.classNameFromFqcn(model.getCustomizationConfig().getCustomRetryPolicy()));
425425
}
426426

427+
if (StringUtils.isNotBlank(model.getCustomizationConfig().getCustomRetryStrategy())) {
428+
builder.addCode(".option($1T.RETRY_STRATEGY, $2T.resolveRetryStrategy(config))",
429+
SdkClientOption.class,
430+
PoetUtils.classNameFromFqcn(model.getCustomizationConfig().getCustomRetryStrategy()));
431+
}
432+
427433
if (StringUtils.isNotBlank(clientConfigClassName)) {
428434
builder.addCode(".option($T.SERVICE_CONFIGURATION, finalServiceConfig)", SdkClientOption.class);
429435
}

0 commit comments

Comments
 (0)