Skip to content

[PROTOTYPE] add ClientContext.createWithTransport - #14412

Closed
whowes wants to merge 1 commit into
mainfrom
whowes/gax-client-context-create-with-transport
Closed

whowes wants to merge 1 commit into
mainfrom
whowes/gax-client-context-create-with-transport

Conversation

@whowes

@whowes whowes commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Context: discussion in #14321. A factory that derives a second-transport ClientContext from an existing one, alternative to having generated resumable upload stub assemble it.

@whowes whowes changed the title feat(gax): [PROTOTYPE] add ClientContext.createWithTransport [PROTOTYPE] add ClientContext.createWithTransport Sep 17, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new static method createWithTransport in ClientContext to allow creating a derived context with a replaced transport channel and internal headers, along with comprehensive unit tests. Feedback was provided regarding a potential NullPointerException when accessing endpointContext without a null check, which should be resolved defensively.

Comment on lines +356 to +366
provider = provider.withUseS2A(endpointContext.useS2A());
if (provider.needsMtlsEndpoint() && endpointContext.mtlsEndpoint() != null) {
provider = provider.withMtlsEndpoint(endpointContext.mtlsEndpoint());
}
TransportChannel channel = provider.getTransportChannel();

ApiCallContext defaultCallContext = channel.getEmptyCallContext().withTransportChannel(channel);
if (credentials != null) {
defaultCallContext = defaultCallContext.withCredentials(credentials);
}
defaultCallContext = defaultCallContext.withEndpointContext(endpointContext);

This comment was marked as off-topic.

@whowes
whowes force-pushed the whowes/gax-client-context-create-with-transport branch from 48a4f7c to 745269d Compare September 17, 2026 02:40
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed for 'gapic-generator-java-root'

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed for 'gapic-generator-java-root'

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@whowes whowes closed this Sep 17, 2026
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