Encapsulates client state, including executor, credentials, and transport channel.
UnlikeClientSettingswhich allows users to configure the client,ClientContextis intended to be used in generated code. Most users will not need to use it.
The objects that need to be closed in order to clean up the resources created in the process of
creating this ClientContext. This will include the closeables from the transport context.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[[["\u003cp\u003eThe latest version available is 2.63.1, with a comprehensive list of versions from 2.62.0 down to 2.7.1 also provided on this page.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eClientContext\u003c/code\u003e is an abstract class that encapsulates client state, including executor, credentials, and transport channel, intended for internal use in generated code rather than direct interaction by most users.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eClientContext\u003c/code\u003e can be instantiated using either \u003ccode\u003eClientSettings\u003c/code\u003e or \u003ccode\u003eStubSettings\u003c/code\u003e, with static methods \u003ccode\u003ecreate(ClientSettings settings)\u003c/code\u003e and \u003ccode\u003ecreate(StubSettings settings)\u003c/code\u003e handling the instantiation processes.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eClientContext\u003c/code\u003e provides several methods to access the client state and resources such as \u003ccode\u003egetExecutor\u003c/code\u003e, \u003ccode\u003egetCredentials\u003c/code\u003e, \u003ccode\u003egetTransportChannel\u003c/code\u003e, \u003ccode\u003egetEndpoint\u003c/code\u003e, among others, that are used in the execution of API calls.\u003c/p\u003e\n"],["\u003cp\u003eThe ClientContext builder can be used with the \u003ccode\u003enewBuilder()\u003c/code\u003e method and can also utilize the current \u003ccode\u003eClientContext\u003c/code\u003e by using \u003ccode\u003etoBuilder()\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,[]]