From 37da0a1c195572ee2cb0eb5b855724f878619275 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Mon, 29 Jan 2024 12:11:37 -0800 Subject: [PATCH] Reduce memory usage in S3 when plugins aren't used. Modifying the SDK client configuration at the request level uses extra memory, because it requires copying the existing configuration map. Before this change, we always modify the client configuration with each request to add the client instance. This change moves this modification to the client-creation, so that the configuration doesn't need to be copied unless plugins also modify the configuration. This change also removes the conditional logic that only added the client for S3, which simplifies the code generator. --- .../next-release/feature-AmazonS3-813e831.json | 6 ++++++ .../codegen/poet/client/AsyncClientClass.java | 14 +++++--------- .../codegen/poet/client/SyncClientClass.java | 14 +++++--------- .../sra/test-aws-json-async-client-class.java | 2 +- .../client/sra/test-json-async-client-class.java | 2 +- .../poet/client/sra/test-json-client-class.java | 2 +- .../client/sra/test-query-async-client-class.java | 2 +- .../poet/client/sra/test-query-client-class.java | 2 +- .../client/sra/test-xml-async-client-class.java | 2 +- .../poet/client/sra/test-xml-client-class.java | 2 +- .../client/test-aws-json-async-client-class.java | 2 +- ...s-query-compatible-json-async-client-class.java | 2 +- ...ws-query-compatible-json-sync-client-class.java | 2 +- .../poet/client/test-custompackage-async.java | 2 +- .../poet/client/test-custompackage-sync.java | 2 +- .../client/test-customservicemetadata-async.java | 2 +- .../client/test-customservicemetadata-sync.java | 2 +- .../poet/client/test-endpoint-discovery-async.java | 2 +- .../poet/client/test-endpoint-discovery-sync.java | 2 +- .../poet/client/test-json-async-client-class.java | 2 +- .../poet/client/test-json-client-class.java | 2 +- .../poet/client/test-query-async-client-class.java | 2 +- .../poet/client/test-query-client-class.java | 2 +- .../poet/client/test-xml-async-client-class.java | 2 +- .../codegen/poet/client/test-xml-client-class.java | 2 +- 25 files changed, 38 insertions(+), 40 deletions(-) create mode 100644 .changes/next-release/feature-AmazonS3-813e831.json diff --git a/.changes/next-release/feature-AmazonS3-813e831.json b/.changes/next-release/feature-AmazonS3-813e831.json new file mode 100644 index 000000000000..26b91446e577 --- /dev/null +++ b/.changes/next-release/feature-AmazonS3-813e831.json @@ -0,0 +1,6 @@ +{ + "type": "feature", + "category": "Amazon S3", + "contributor": "", + "description": "Reduce memory usage when request-level plugins aren't used." +} diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/AsyncClientClass.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/AsyncClientClass.java index d3b465b66a77..4490e00fb9f4 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/AsyncClientClass.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/AsyncClientClass.java @@ -172,8 +172,7 @@ protected void addAdditionalMethods(TypeSpec.Builder type) { type.addMethod(isSignerOverriddenOnClientMethod()); } } - type.addMethod(updateSdkClientConfigurationMethod(configurationUtils.serviceClientConfigurationBuilderClassName(), - "S3".equals(model.getMetadata().getServiceName()))); + type.addMethod(updateSdkClientConfigurationMethod(configurationUtils.serviceClientConfigurationBuilderClassName())); protocolSpec.createErrorResponseHandler().ifPresent(type::addMethod); } @@ -222,7 +221,9 @@ private MethodSpec constructor(TypeSpec.Builder classBuilder) { .addModifiers(PROTECTED) .addParameter(SdkClientConfiguration.class, "clientConfiguration") .addStatement("this.clientHandler = new $T(clientConfiguration)", AwsAsyncClientHandler.class) - .addStatement("this.clientConfiguration = clientConfiguration"); + .addStatement("this.clientConfiguration = clientConfiguration.toBuilder()" + + ".option($T.SDK_CLIENT, this)" + + ".build()", SdkClientOption.class); FieldSpec protocolFactoryField = protocolSpec.protocolFactory(model); if (model.getMetadata().isJsonProtocol()) { builder.addStatement("this.$N = init($T.builder()).build()", protocolFactoryField.name, @@ -293,8 +294,7 @@ protected MethodSpec serviceClientConfigMethod() { } protected static MethodSpec updateSdkClientConfigurationMethod( - TypeName serviceClientConfigurationBuilderClassName, - boolean shouldAddClientReference) { + TypeName serviceClientConfigurationBuilderClassName) { MethodSpec.Builder builder = MethodSpec.methodBuilder("updateSdkClientConfiguration") .addModifiers(PRIVATE) .addParameter(SdkRequest.class, "request") @@ -306,10 +306,6 @@ protected static MethodSpec updateSdkClientConfigurationMethod( ParameterizedTypeName.get(List.class, SdkPlugin.class)) .addStatement("$T configuration = clientConfiguration.toBuilder()", SdkClientConfiguration.Builder.class); - if (shouldAddClientReference) { - builder.addStatement("configuration.option($T.SDK_CLIENT, this)", SdkClientOption.class); - } - builder.beginControlFlow("if (plugins.isEmpty())") .addStatement("return configuration.build()") .endControlFlow() diff --git a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/SyncClientClass.java b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/SyncClientClass.java index 95cb77412076..f0fba58873f6 100644 --- a/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/SyncClientClass.java +++ b/codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/SyncClientClass.java @@ -148,8 +148,7 @@ protected void addAdditionalMethods(TypeSpec.Builder type) { .addMethod(resolveMetricPublishersMethod()); protocolSpec.createErrorResponseHandler().ifPresent(type::addMethod); - type.addMethod(updateSdkClientConfigurationMethod(configurationUtils.serviceClientConfigurationBuilderClassName(), - "S3".equals(model.getMetadata().getServiceName()))); + type.addMethod(updateSdkClientConfigurationMethod(configurationUtils.serviceClientConfigurationBuilderClassName())); type.addMethod(protocolSpec.initProtocolFactory(model)); } @@ -197,7 +196,9 @@ private MethodSpec constructor() { .addModifiers(PROTECTED) .addParameter(SdkClientConfiguration.class, "clientConfiguration") .addStatement("this.clientHandler = new $T(clientConfiguration)", protocolSpec.getClientHandlerClass()) - .addStatement("this.clientConfiguration = clientConfiguration"); + .addStatement("this.clientConfiguration = clientConfiguration.toBuilder()" + + ".option($T.SDK_CLIENT, this)" + + ".build()", SdkClientOption.class); FieldSpec protocolFactoryField = protocolSpec.protocolFactory(model); if (model.getMetadata().isJsonProtocol()) { @@ -426,8 +427,7 @@ protected MethodSpec.Builder waiterOperationBody(MethodSpec.Builder builder) { } protected MethodSpec updateSdkClientConfigurationMethod( - TypeName serviceClientConfigurationBuilderClassName, - boolean shouldAddClientReference) { + TypeName serviceClientConfigurationBuilderClassName) { MethodSpec.Builder builder = MethodSpec.methodBuilder("updateSdkClientConfiguration") .addModifiers(PRIVATE) .addParameter(SdkRequest.class, "request") @@ -439,10 +439,6 @@ protected MethodSpec updateSdkClientConfigurationMethod( ParameterizedTypeName.get(List.class, SdkPlugin.class)) .addStatement("$T configuration = clientConfiguration.toBuilder()", SdkClientConfiguration.Builder.class); - if (shouldAddClientReference) { - builder.addStatement("configuration.option($T.SDK_CLIENT, this)", SdkClientOption.class); - } - builder.beginControlFlow("if (plugins.isEmpty())") .addStatement("return configuration.build()") .endControlFlow() diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-aws-json-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-aws-json-async-client-class.java index bd61702ee884..721da70756f2 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-aws-json-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-aws-json-async-client-class.java @@ -133,7 +133,7 @@ final class DefaultJsonAsyncClient implements JsonAsyncClient { protected DefaultJsonAsyncClient(SdkClientConfiguration clientConfiguration) { this.clientHandler = new AwsAsyncClientHandler(clientConfiguration); - this.clientConfiguration = clientConfiguration; + this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build(); this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build(); this.executor = clientConfiguration.option(SdkAdvancedAsyncClientOption.FUTURE_COMPLETION_EXECUTOR); } diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-async-client-class.java index a64db8d40ed6..b31d21fa7637 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-async-client-class.java @@ -141,7 +141,7 @@ final class DefaultJsonAsyncClient implements JsonAsyncClient { protected DefaultJsonAsyncClient(SdkClientConfiguration clientConfiguration) { this.clientHandler = new AwsAsyncClientHandler(clientConfiguration); - this.clientConfiguration = clientConfiguration; + this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build(); this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build(); this.executor = clientConfiguration.option(SdkAdvancedAsyncClientOption.FUTURE_COMPLETION_EXECUTOR); } diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-client-class.java index 8d08737d1d75..1937b0d393b2 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-json-client-class.java @@ -100,7 +100,7 @@ final class DefaultJsonClient implements JsonClient { protected DefaultJsonClient(SdkClientConfiguration clientConfiguration) { this.clientHandler = new AwsSyncClientHandler(clientConfiguration); - this.clientConfiguration = clientConfiguration; + this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build(); this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build(); } diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-query-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-query-async-client-class.java index 271ccb784040..ddf56055a3c6 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-query-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-query-async-client-class.java @@ -103,7 +103,7 @@ final class DefaultQueryAsyncClient implements QueryAsyncClient { protected DefaultQueryAsyncClient(SdkClientConfiguration clientConfiguration) { this.clientHandler = new AwsAsyncClientHandler(clientConfiguration); - this.clientConfiguration = clientConfiguration; + this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build(); this.protocolFactory = init(); this.executorService = clientConfiguration.option(SdkClientOption.SCHEDULED_EXECUTOR_SERVICE); } diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-query-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-query-client-class.java index d7fb402cd792..de30297738dc 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-query-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-query-client-class.java @@ -94,7 +94,7 @@ final class DefaultQueryClient implements QueryClient { protected DefaultQueryClient(SdkClientConfiguration clientConfiguration) { this.clientHandler = new AwsSyncClientHandler(clientConfiguration); - this.clientConfiguration = clientConfiguration; + this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build(); this.protocolFactory = init(); } diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-xml-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-xml-async-client-class.java index 38db12176238..fa54d4a765c5 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-xml-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-xml-async-client-class.java @@ -108,7 +108,7 @@ final class DefaultXmlAsyncClient implements XmlAsyncClient { protected DefaultXmlAsyncClient(SdkClientConfiguration clientConfiguration) { this.clientHandler = new AwsAsyncClientHandler(clientConfiguration); - this.clientConfiguration = clientConfiguration; + this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build(); this.protocolFactory = init(); this.executor = clientConfiguration.option(SdkAdvancedAsyncClientOption.FUTURE_COMPLETION_EXECUTOR); } diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-xml-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-xml-client-class.java index b5faa021d650..f96469e1422f 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-xml-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/sra/test-xml-client-class.java @@ -89,7 +89,7 @@ final class DefaultXmlClient implements XmlClient { protected DefaultXmlClient(SdkClientConfiguration clientConfiguration) { this.clientHandler = new AwsSyncClientHandler(clientConfiguration); - this.clientConfiguration = clientConfiguration; + this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build(); this.protocolFactory = init(); } diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-json-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-json-async-client-class.java index 0b95dfd7fc6e..37a8d4803d1a 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-json-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-json-async-client-class.java @@ -140,7 +140,7 @@ final class DefaultJsonAsyncClient implements JsonAsyncClient { protected DefaultJsonAsyncClient(SdkClientConfiguration clientConfiguration) { this.clientHandler = new AwsAsyncClientHandler(clientConfiguration); - this.clientConfiguration = clientConfiguration; + this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build(); this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build(); this.executor = clientConfiguration.option(SdkAdvancedAsyncClientOption.FUTURE_COMPLETION_EXECUTOR); } diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-async-client-class.java index f3cb45af943c..47ef62c35751 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-async-client-class.java @@ -60,7 +60,7 @@ final class DefaultQueryToJsonCompatibleAsyncClient implements QueryToJsonCompat protected DefaultQueryToJsonCompatibleAsyncClient(SdkClientConfiguration clientConfiguration) { this.clientHandler = new AwsAsyncClientHandler(clientConfiguration); - this.clientConfiguration = clientConfiguration; + this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build(); this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build(); } diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-sync-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-sync-client-class.java index 743fedebb338..85e39bcc67bf 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-sync-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-aws-query-compatible-json-sync-client-class.java @@ -56,7 +56,7 @@ final class DefaultQueryToJsonCompatibleClient implements QueryToJsonCompatibleC protected DefaultQueryToJsonCompatibleClient(SdkClientConfiguration clientConfiguration) { this.clientHandler = new AwsSyncClientHandler(clientConfiguration); - this.clientConfiguration = clientConfiguration; + this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build(); this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build(); } diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-custompackage-async.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-custompackage-async.java index 8ff2ba1a9319..ebcb96eb3c05 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-custompackage-async.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-custompackage-async.java @@ -57,7 +57,7 @@ final class DefaultProtocolRestJsonWithCustomPackageAsyncClient implements Proto protected DefaultProtocolRestJsonWithCustomPackageAsyncClient(SdkClientConfiguration clientConfiguration) { this.clientHandler = new AwsAsyncClientHandler(clientConfiguration); - this.clientConfiguration = clientConfiguration; + this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build(); this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build(); } diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-custompackage-sync.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-custompackage-sync.java index f024a8157593..d5b297ffc1d0 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-custompackage-sync.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-custompackage-sync.java @@ -53,7 +53,7 @@ final class DefaultProtocolRestJsonWithCustomPackageClient implements ProtocolRe protected DefaultProtocolRestJsonWithCustomPackageClient(SdkClientConfiguration clientConfiguration) { this.clientHandler = new AwsSyncClientHandler(clientConfiguration); - this.clientConfiguration = clientConfiguration; + this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build(); this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build(); } diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-customservicemetadata-async.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-customservicemetadata-async.java index 3d60f7a83fb2..88fa5fb4c4bf 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-customservicemetadata-async.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-customservicemetadata-async.java @@ -57,7 +57,7 @@ final class DefaultProtocolRestJsonWithCustomContentTypeAsyncClient implements P protected DefaultProtocolRestJsonWithCustomContentTypeAsyncClient(SdkClientConfiguration clientConfiguration) { this.clientHandler = new AwsAsyncClientHandler(clientConfiguration); - this.clientConfiguration = clientConfiguration; + this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build(); this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build(); } diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-customservicemetadata-sync.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-customservicemetadata-sync.java index d4ee3fbc396e..d252296403e3 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-customservicemetadata-sync.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-customservicemetadata-sync.java @@ -53,7 +53,7 @@ final class DefaultProtocolRestJsonWithCustomContentTypeClient implements Protoc protected DefaultProtocolRestJsonWithCustomContentTypeClient(SdkClientConfiguration clientConfiguration) { this.clientHandler = new AwsSyncClientHandler(clientConfiguration); - this.clientConfiguration = clientConfiguration; + this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build(); this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build(); } diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-endpoint-discovery-async.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-endpoint-discovery-async.java index 3d89eea05731..a514a7f460e9 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-endpoint-discovery-async.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-endpoint-discovery-async.java @@ -74,7 +74,7 @@ final class DefaultEndpointDiscoveryTestAsyncClient implements EndpointDiscovery protected DefaultEndpointDiscoveryTestAsyncClient(SdkClientConfiguration clientConfiguration) { this.clientHandler = new AwsAsyncClientHandler(clientConfiguration); - this.clientConfiguration = clientConfiguration; + this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build(); this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build(); if (clientConfiguration.option(SdkClientOption.ENDPOINT_DISCOVERY_ENABLED)) { this.endpointDiscoveryCache = EndpointDiscoveryRefreshCache diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-endpoint-discovery-sync.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-endpoint-discovery-sync.java index 618287cc5df3..1ee719380382 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-endpoint-discovery-sync.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-endpoint-discovery-sync.java @@ -72,7 +72,7 @@ final class DefaultEndpointDiscoveryTestClient implements EndpointDiscoveryTestC protected DefaultEndpointDiscoveryTestClient(SdkClientConfiguration clientConfiguration) { this.clientHandler = new AwsSyncClientHandler(clientConfiguration); - this.clientConfiguration = clientConfiguration; + this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build(); this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build(); if (clientConfiguration.option(SdkClientOption.ENDPOINT_DISCOVERY_ENABLED)) { this.endpointDiscoveryCache = EndpointDiscoveryRefreshCache.create(EndpointDiscoveryTestEndpointDiscoveryCacheLoader diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-async-client-class.java index c30ad3572f91..778e6ab56808 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-async-client-class.java @@ -149,7 +149,7 @@ final class DefaultJsonAsyncClient implements JsonAsyncClient { protected DefaultJsonAsyncClient(SdkClientConfiguration clientConfiguration) { this.clientHandler = new AwsAsyncClientHandler(clientConfiguration); - this.clientConfiguration = clientConfiguration; + this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build(); this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build(); this.executor = clientConfiguration.option(SdkAdvancedAsyncClientOption.FUTURE_COMPLETION_EXECUTOR); } diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-client-class.java index c50f30a6382f..9ab99f520fd5 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-json-client-class.java @@ -106,7 +106,7 @@ final class DefaultJsonClient implements JsonClient { protected DefaultJsonClient(SdkClientConfiguration clientConfiguration) { this.clientHandler = new AwsSyncClientHandler(clientConfiguration); - this.clientConfiguration = clientConfiguration; + this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build(); this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build(); } diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-query-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-query-async-client-class.java index c9e4fd24427f..11e753cf4dd6 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-query-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-query-async-client-class.java @@ -109,7 +109,7 @@ final class DefaultQueryAsyncClient implements QueryAsyncClient { protected DefaultQueryAsyncClient(SdkClientConfiguration clientConfiguration) { this.clientHandler = new AwsAsyncClientHandler(clientConfiguration); - this.clientConfiguration = clientConfiguration; + this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build(); this.protocolFactory = init(); this.executorService = clientConfiguration.option(SdkClientOption.SCHEDULED_EXECUTOR_SERVICE); } diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-query-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-query-client-class.java index cc90d386ef98..b32c43fb395b 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-query-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-query-client-class.java @@ -99,7 +99,7 @@ final class DefaultQueryClient implements QueryClient { protected DefaultQueryClient(SdkClientConfiguration clientConfiguration) { this.clientHandler = new AwsSyncClientHandler(clientConfiguration); - this.clientConfiguration = clientConfiguration; + this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build(); this.protocolFactory = init(); } diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-xml-async-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-xml-async-client-class.java index 343ec21f22ac..fb00ce52de6a 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-xml-async-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-xml-async-client-class.java @@ -114,7 +114,7 @@ final class DefaultXmlAsyncClient implements XmlAsyncClient { protected DefaultXmlAsyncClient(SdkClientConfiguration clientConfiguration) { this.clientHandler = new AwsAsyncClientHandler(clientConfiguration); - this.clientConfiguration = clientConfiguration; + this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build(); this.protocolFactory = init(); this.executor = clientConfiguration.option(SdkAdvancedAsyncClientOption.FUTURE_COMPLETION_EXECUTOR); } diff --git a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-xml-client-class.java b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-xml-client-class.java index 705ab47f7ca4..308251805754 100644 --- a/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-xml-client-class.java +++ b/codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-xml-client-class.java @@ -94,7 +94,7 @@ final class DefaultXmlClient implements XmlClient { protected DefaultXmlClient(SdkClientConfiguration clientConfiguration) { this.clientHandler = new AwsSyncClientHandler(clientConfiguration); - this.clientConfiguration = clientConfiguration; + this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build(); this.protocolFactory = init(); }