Package com.google.api.gax.rpc
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
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 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 ApiClockgetClock()abstract com.google.auth.CredentialsgetCredentials()abstract ApiCallContextgetDefaultCallContext()abstract StringgetEndpoint()abstract ScheduledExecutorServicegetExecutor()Gets the executor to use for running scheduled API call logic (such as retries and long-running operations).abstract Map<String,String>getHeaders()protected abstract Map<String,String>getInternalHeaders()abstract 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 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()
-
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 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 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
-
-