Skip to content

Remove resolveClientEndpointProvider from AwsDefaultClientBuilder#7186

Open
S-Saranya1 wants to merge 2 commits into
feature/master/remove-service-metadata-usagefrom
somepal/remove-resolve-client-endpoint-provider
Open

Remove resolveClientEndpointProvider from AwsDefaultClientBuilder#7186
S-Saranya1 wants to merge 2 commits into
feature/master/remove-service-metadata-usagefrom
somepal/remove-resolve-client-endpoint-provider

Conversation

@S-Saranya1

@S-Saranya1 S-Saranya1 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Motivation and Context

AwsDefaultClientBuilder.resolveClientEndpointProvider() was triggering GeneratedServiceMetadataProvider initialization (~350ms) during every client creation. Although registered via lazyOptionIfAbsent as a fallback for older clients, AttributeMap.build() eagerly resolves all lazy values — causing the fallback to execute even when the generated builder already set CLIENT_ENDPOINT_PROVIDER. All generated clients have set it themselves since 2024, making this fallback dead code with a significant performance cost.

Additionally, AwsClientEndpointProvider.build() is the method that calls ServiceMetadata.of() and triggers the expensive initialization. After our changes across PRs #7094, #7105, #7110, #7168, no code path in client creation calls it anymore. Deprecating it signals to not use and use resolveFromOverrides() + service EndpointProvider instead, and prevents accidental re-introduction of the performance issue.

Modifications

  • Removed resolveClientEndpointProvider() method and its lazyOptionIfAbsent registration from AwsDefaultClientBuilder.finalizeAwsConfiguration()
  • Removed unused AwsClientEndpointProvider import and DEFAULT_ENDPOINT_PROTOCOL constant
  • Added null validation in resolveEndpoint() and resolveEndpointOverridden() with clear error message for custom clients that don't set CLIENT_ENDPOINT_PROVIDER
  • Deprecated AwsClientEndpointProvider.build() — points users to resolveFromOverrides() + service EndpointProvider instead
  • Updated TestClientBuilder and TestAsyncClientBuilder in tests to set CLIENT_ENDPOINT_PROVIDER in finalizeServiceConfiguration(), mirroring what real generated builders do

Testing

  • All 32 existing tests in DefaultAwsClientBuilderTest pass
  • Tests updated to set CLIENT_ENDPOINT_PROVIDER directly (same pattern as generated builders)

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING document
  • Local run of mvn install succeeds
  • My code follows the code style of this project
  • My change requires a change to the Javadoc documentation
  • I have updated the Javadoc documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed
  • I have added a changelog entry. Adding a new entry must be accomplished by running the scripts/new-change script and following the instructions. Commit the new file created by the script in .changes/next-release with your changes.
  • My change is to implement 1.11 parity feature and I have updated LaunchChangelog

License

  • I confirm that this pull request can be released under the Apache 2 license

   This fallback method was triggering GeneratedServiceMetadataProvider
   initialization (~350ms) during every client creation because
   AttributeMap.build() eagerly resolves all lazy values including
   lazyOptionIfAbsent fallbacks. All generated clients have set
   CLIENT_ENDPOINT_PROVIDER themselves since SDK 2.27.16. Added null
   validation with clear error message for custom clients that don't
   set it
@S-Saranya1
S-Saranya1 requested a review from a team as a code owner July 23, 2026 15:01
@S-Saranya1 S-Saranya1 mentioned this pull request Jul 23, 2026
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant