Package com.google.api.gax.rpc
Class ClientContext
- java.lang.Object
-
- com.google.api.gax.rpc.ClientContext
-
public abstract class ClientContext extends java.lang.ObjectEncapsulates client state, including executor, credentials, and transport channel.Unlike
ClientSettingswhich allows users to configure the client,ClientContextis intended to be used in generated code. Most users will not need to use it.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classClientContext.Builder
-
Constructor Summary
Constructors Constructor Description ClientContext()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static ClientContextcreate(ClientSettings settings)Instantiates the executor, credentials, and transport context based on the given client settings.static ClientContextcreate(StubSettings settings)Instantiates the executor, credentials, and transport context based on the given client settings.abstract java.util.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.abstract com.google.api.core.ApiClockgetClock()abstract com.google.auth.CredentialsgetCredentials()abstract ApiCallContextgetDefaultCallContext()abstract java.lang.StringgetEndpoint()abstract java.util.concurrent.ScheduledExecutorServicegetExecutor()Gets the executor to use for running scheduled API call logic (such as retries and long-running operations).abstract java.util.Map<java.lang.String,java.lang.String>getHeaders()protected abstract java.util.Map<java.lang.String,java.lang.String>getInternalHeaders()abstract java.lang.StringgetQuotaProjectId()abstract WatchdoggetStreamWatchdog()abstract org.threeten.bp.DurationgetStreamWatchdogCheckInterval()abstract ApiTracerFactorygetTracerFactory()Gets theApiTracerFactorythat will be used to generate traces for operations.abstract TransportChannelgetTransportChannel()static ClientContext.BuildernewBuilder()abstract ClientContext.BuildertoBuilder()
-
-
-
Method Detail
-
getBackgroundResources
public abstract java.util.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 java.util.concurrent.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 java.util.Map<java.lang.String,java.lang.String> getHeaders()
-
getInternalHeaders
protected abstract java.util.Map<java.lang.String,java.lang.String> getInternalHeaders()
-
getClock
public abstract com.google.api.core.ApiClock getClock()
-
getDefaultCallContext
public abstract ApiCallContext getDefaultCallContext()
-
getStreamWatchdog
@Nullable public abstract Watchdog getStreamWatchdog()
-
getStreamWatchdogCheckInterval
@Nonnull public abstract org.threeten.bp.Duration getStreamWatchdogCheckInterval()
-
getEndpoint
@Nullable public abstract java.lang.String getEndpoint()
-
getQuotaProjectId
@Nullable public abstract java.lang.String getQuotaProjectId()
-
getTracerFactory
@BetaApi("The surface for tracing is not stable yet and may change in the future.") @Nonnull public abstract ApiTracerFactory getTracerFactory()Gets theApiTracerFactorythat will be used to generate traces for operations.
-
newBuilder
public static ClientContext.Builder newBuilder()
-
toBuilder
public abstract ClientContext.Builder toBuilder()
-
create
public static ClientContext create(ClientSettings settings) throws java.io.IOException
Instantiates the executor, credentials, and transport context based on the given client settings.- Throws:
java.io.IOException
-
create
public static ClientContext create(StubSettings settings) throws java.io.IOException
Instantiates the executor, credentials, and transport context based on the given client settings.- Throws:
java.io.IOException
-
-