Class ClientContext

java.lang.Object
com.google.api.gax.rpc.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 Details

    • ClientContext

      public ClientContext()
  • Method Details

    • 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()
    • getTransportChannel

      @Nullable public abstract TransportChannel getTransportChannel()
    • getHeaders

      public abstract Map<String,String> getHeaders()
    • getInternalHeaders

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

      public abstract ApiClock getClock()
    • getDefaultCallContext

      public abstract ApiCallContext getDefaultCallContext()
    • getStreamWatchdog

      @Nullable public abstract Watchdog getStreamWatchdog()
    • getStreamWatchdogCheckInterval

      @Nonnull @ObsoleteApi("Use getStreamWatchdogCheckIntervalDuration() instead") public final org.threeten.bp.Duration getStreamWatchdogCheckInterval()
      This method is obsolete. Use getStreamWatchdogCheckIntervalDuration() instead.
    • getStreamWatchdogCheckIntervalDuration

      @Nonnull public abstract Duration getStreamWatchdogCheckIntervalDuration()
    • getUniverseDomain

      @Nullable public abstract String getUniverseDomain()
    • getEndpoint

      @Nullable public abstract String getEndpoint()
    • getQuotaProjectId

      @Nullable public abstract String getQuotaProjectId()
    • 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.
    • getGdchApiAudience

      @Nullable public abstract String getGdchApiAudience()
      Gets the API audience used when creating a Client that uses GdchCredentials
    • newBuilder

      public static ClientContext.Builder newBuilder()
      Create a new ClientContext with default values
    • toBuilder

      public abstract ClientContext.Builder toBuilder()
    • create

      public static ClientContext create(ClientSettings settings) throws IOException
      Instantiates the executor, credentials, and transport context based on the given client settings.
      Throws:
      IOException
    • create

      public static ClientContext create(StubSettings settings) throws IOException
      Instantiates the executor, credentials, and transport context based on the given client settings.
      Throws:
      IOException