GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — fix: Create a single S2AChannelCredentials per application by rmehta19 · Pull Request #3989 · googleapis/sdk-platform-java
This repository was archived by the owner on Oct 29, 2026. It is now read-only.
Conversation
Contributor
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Code ReviewThis pull request introduces two main improvements. First, it implements caching for S2A channel credentials using a thread-safe, double-checked locking pattern to avoid re-creating them on every call. Second, it updates the mTLS credential creation to use
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Creating a new The A better approach would be to use a shared, static private static final ScheduledExecutorService S2A_TRUST_MANAGER_EXECUTOR = Executors.newSingleThreadScheduledExecutor( r -> { Thread t = new Thread(r, "s2a-trust-manager-updater"); t.setDaemon(true); return t; }); You could then use this static executor in the
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsThere was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While the AI isn't smart enough to realize there will only be one executor created, and thus it doesn't benefit from being stored as a static, it is correct that this really needs to be a daemon thread to avoid keeping the JVM alive.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Comment on lines
608
to
660
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The logic inside the Consider refactoring this block to simplify the control flow. A clearer structure would be to attempt creating mTLS credentials first, and if that fails for any reason, then fall back to creating plaintext credentials. This would centralize the fallback logic. For example, you could extract the creation logic into a helper method that returns the created credentials, which simplifies the double-checked locking block: // In createS2ASecuredChannelCredentials(): if (s2aChannelCredentialsObject == null) { synchronized (InstantiatingGrpcChannelProvider.class) { if (s2aChannelCredentialsObject == null) { s2aChannelCredentialsObject = createS2ACredentialsOnce(); } } } return s2aChannelCredentialsObject; // New helper method: private ChannelCredentials createS2ACredentialsOnce() { // ... logic to try mTLS and fallback to plaintext ... }
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
xmenxk
reviewed
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks!
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: maybe add a comment here that we are using this single credentials object?
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good call, added a comment about this.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Comment on lines
+609
to
+611
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. curious why doing the null check on both line 609 and 611?
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for reviewing! This is part of the double checked locking pattern, WDYT?
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
rockspore
approved these changes
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the PR. LGTM.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
xmenxk
approved these changes
Contributor
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
ejona86
reviewed
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The private key never changes? I had expected polling for both sets of files, with the private key's cert chain being the most important, as it is probably a shorter-lived certificate than the CA.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for catching, I did miss this. Added.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While the AI isn't smart enough to realize there will only be one executor created, and thus it doesn't benefit from being stored as a static, it is correct that this really needs to be a daemon thread to avoid keeping the JVM alive.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note that leaking this Closeable will expose applications to leaking class loaders, as this task will prevent the class loader from being GCed when it is no longer needed (as is common in servlet containers). However, fixing that would be a pretty big pain as you'd need to track usage of the channel/credential. S2a might be able to go years before that becomes a problem.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
lqiu96
reviewed
Uh oh!
There was an error while loading. Please reload this page.
lqiu96
reviewed
Uh oh!
There was an error while loading. Please reload this page.
lqiu96
reviewed
Uh oh!
There was an error while loading. Please reload this page.
lqiu96
reviewed
Uh oh!
There was an error while loading. Please reload this page.
lqiu96
reviewed
Uh oh!
There was an error while loading. Please reload this page.
lqiu96
reviewed
Uh oh!
There was an error while loading. Please reload this page.
Member
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Contributor
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Member
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
lqiu96
approved these changes
This was referenced
diegomarquezp
pushed a commit
that referenced
this pull request
🤖 I have created a release *beep* *boop* --- <details><summary>2.65.0</summary> ## [2.65.0](v2.64.2...v2.65.0) (2026-01-12) ### Features * add org.json:json to third-party-dependencies pom ([#4047](#4047)) ([ffa432e](ffa432e)), closes [#4046](#4046) * remove dependency management of graal-sdk ([#4033](#4033)) ([ad05c34](ad05c34)) ### Bug Fixes * add api_version breadcrumb to client docs ([#4018](#4018)) ([a2b2179](a2b2179)) * Create a single S2AChannelCredentials per application ([#3989](#3989)) ([3758b43](3758b43)) * provide API to share the same background executor for channel po… ([#4030](#4030)) ([178182c](178182c)) ### Dependencies * update dependencies.txt for grpc-gcp to 1.9.0 ([#4025](#4025)) ([b68791d](b68791d)) * update google api dependencies ([#3917](#3917)) ([480cf13](480cf13)) * update google.http-client.version to 2.0.3 ([#4054](#4054)) ([b9a8c89](b9a8c89)) ### Documentation * Fix retry guide link in javadocs ([#4029](#4029)) ([b43f77c](b43f77c)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
diegomarquezp
pushed a commit
that referenced
this pull request
diegomarquezp
pushed a commit
that referenced
this pull request
🤖 I have created a release *beep* *boop* --- <details><summary>2.65.0</summary> ## [2.65.0](v2.64.2...v2.65.0) (2026-01-12) ### Features * add org.json:json to third-party-dependencies pom ([#4047](#4047)) ([ffa432e](ffa432e)), closes [#4046](#4046) * remove dependency management of graal-sdk ([#4033](#4033)) ([ad05c34](ad05c34)) ### Bug Fixes * add api_version breadcrumb to client docs ([#4018](#4018)) ([a2b2179](a2b2179)) * Create a single S2AChannelCredentials per application ([#3989](#3989)) ([3758b43](3758b43)) * provide API to share the same background executor for channel po… ([#4030](#4030)) ([178182c](178182c)) ### Dependencies * update dependencies.txt for grpc-gcp to 1.9.0 ([#4025](#4025)) ([b68791d](b68791d)) * update google api dependencies ([#3917](#3917)) ([480cf13](480cf13)) * update google.http-client.version to 2.0.3 ([#4054](#4054)) ([b9a8c89](b9a8c89)) ### Documentation * Fix retry guide link in javadocs ([#4029](#4029)) ([b43f77c](b43f77c)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
lqiu96
pushed a commit
that referenced
this pull request
lqiu96
pushed a commit
that referenced
this pull request
🤖 I have created a release *beep* *boop* --- <details><summary>2.65.0</summary> ## [2.65.0](v2.64.2...v2.65.0) (2026-01-12) ### Features * add org.json:json to third-party-dependencies pom ([#4047](#4047)) ([ffa432e](ffa432e)), closes [#4046](#4046) * remove dependency management of graal-sdk ([#4033](#4033)) ([ad05c34](ad05c34)) ### Bug Fixes * add api_version breadcrumb to client docs ([#4018](#4018)) ([a2b2179](a2b2179)) * Create a single S2AChannelCredentials per application ([#3989](#3989)) ([3758b43](3758b43)) * provide API to share the same background executor for channel po… ([#4030](#4030)) ([178182c](178182c)) ### Dependencies * update dependencies.txt for grpc-gcp to 1.9.0 ([#4025](#4025)) ([b68791d](b68791d)) * update google api dependencies ([#3917](#3917)) ([480cf13](480cf13)) * update google.http-client.version to 2.0.3 ([#4054](#4054)) ([b9a8c89](b9a8c89)) ### Documentation * Fix retry guide link in javadocs ([#4029](#4029)) ([b43f77c](b43f77c)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
chingor13
pushed a commit
to googleapis/google-cloud-java
that referenced
this pull request
🤖 I have created a release *beep* *boop* --- <details><summary>2.65.0</summary> ## [2.65.0](googleapis/sdk-platform-java@v2.64.2...v2.65.0) (2026-01-12) ### Features * add org.json:json to third-party-dependencies pom ([#4047](googleapis/sdk-platform-java#4047)) ([5898abd](googleapis/sdk-platform-java@5898abd)), closes [#4046](googleapis/sdk-platform-java#4046) * remove dependency management of graal-sdk ([#4033](googleapis/sdk-platform-java#4033)) ([09ec2a3](googleapis/sdk-platform-java@09ec2a3)) ### Bug Fixes * add api_version breadcrumb to client docs ([#4018](googleapis/sdk-platform-java#4018)) ([0573232](googleapis/sdk-platform-java@0573232)) * Create a single S2AChannelCredentials per application ([#3989](googleapis/sdk-platform-java#3989)) ([6a24164](googleapis/sdk-platform-java@6a24164)) * provide API to share the same background executor for channel po… ([#4030](googleapis/sdk-platform-java#4030)) ([051f76a](googleapis/sdk-platform-java@051f76a)) ### Dependencies * update dependencies.txt for grpc-gcp to 1.9.0 ([#4025](googleapis/sdk-platform-java#4025)) ([2376f6c](googleapis/sdk-platform-java@2376f6c)) * update google api dependencies ([#3917](googleapis/sdk-platform-java#3917)) ([bf94a0a](googleapis/sdk-platform-java@bf94a0a)) * update google.http-client.version to 2.0.3 ([#4054](googleapis/sdk-platform-java#4054)) ([343a8ef](googleapis/sdk-platform-java@343a8ef)) ### Documentation * Fix retry guide link in javadocs ([#4029](googleapis/sdk-platform-java#4029)) ([4bb3ccc](googleapis/sdk-platform-java@4bb3ccc)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Reviewers5 more reviewersUh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabels
size: m
ProjectsMilestoneNo milestoneDevelopmentSuccessfully merging this pull request may close these issues. Uh oh!
There was an error while loading. Please reload this page. Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |