Class ClientContext


  • public abstract class ClientContext
    extends Object
    Encapsulates client state, including executor, credentials, and transport channel.

    Unlike ClientSettings which allows users to configure the client, ClientContext is intended to be used in generated code. Most users will not need to use it.

    • Constructor Detail

      • ClientContext

        public ClientContext()
    • Method Detail

      • getBackgroundResources

        public abstract List<BackgroundResource> getBackgroundResources()
        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.
      • getExecutor

        public abstract ScheduledExecutorService getExecutor()
        Gets the executor to use for running scheduled API call logic (such as retries and long-running operations).
      • getCredentials

        @Nullable
        public abstract com.google.auth.Credentials getCredentials()
      • getInternalHeaders

        protected abstract Map<String,​String> getInternalHeaders()
      • getClock

        public abstract ApiClock getClock()
      • getDefaultCallContext

        public abstract ApiCallContext getDefaultCallContext()
      • getStreamWatchdogCheckInterval

        @Nonnull
        public abstract org.threeten.bp.Duration getStreamWatchdogCheckInterval()
      • getTracerFactory

        @BetaApi("The surface for tracing is not stable yet and may change in the future.")
        @Nonnull
        public abstract ApiTracerFactory getTracerFactory()
        Gets the ApiTracerFactory that will be used to generate traces for operations.