Package com.google.cloud.spanner
Class SpannerOptions
java.lang.Object
com.google.cloud.ServiceOptions<Spanner,SpannerOptions>
com.google.cloud.spanner.SpannerOptions
- All Implemented Interfaces:
Serializable
Options for the Cloud Spanner service.
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Builder forSpannerOptions
instances.static interface
SpannerOptions.CallContextConfigurator
can be used to modify theApiCallContext
for one or more specific RPCs.static interface
Interface that can be used to provideCallCredentials
toSpannerOptions
.static interface
ExecutorProvider
that is used forAsyncResultSet
.static class
Implementation ofSpannerOptions.CloseableExecutorProvider
that uses a fixed singleScheduledExecutorService
.static class
Helper class to configure timeouts for specific Spanner RPCs.static interface
The environment to read configuration values from. -
Field Summary
Modifier and TypeFieldDescriptionstatic final io.grpc.Context.Key<SpannerOptions.CallContextConfigurator>
Context key for theSpannerOptions.CallContextConfigurator
to use.Fields inherited from class com.google.cloud.ServiceOptions
clientLibToken, CREDENTIAL_ENV_NAME, credentials
-
Method Summary
Modifier and TypeMethodDescriptioncreateAsyncExecutorProvider
(int poolSize, long keepAliveTime, TimeUnit unit) Creates aSpannerOptions.CloseableExecutorProvider
that can be used as anExecutorProvider
for the async API.com.google.api.core.ApiFunction<io.grpc.ManagedChannelBuilder,
io.grpc.ManagedChannelBuilder> com.google.api.gax.rpc.TransportChannelProvider
static com.google.cloud.grpc.GrpcTransportOptions
protected String
static SpannerOptions
Returns default instance ofSpannerOptions
.protected String
getDefaultQueryOptions
(DatabaseId databaseId) Returns the default query options to use for the specific database.com.google.cloud.grpc.GcpManagedChannelOptions
com.google.api.gax.grpc.GrpcInterceptorProvider
int
org.threeten.bp.Duration
int
com.google.api.gax.retrying.RetrySettings
protected SpannerRpc
boolean
boolean
boolean
boolean
static SpannerOptions.Builder
protected boolean
shouldRefreshRpc
(com.google.cloud.ServiceRpc cachedRpc) protected boolean
shouldRefreshService
(Spanner cachedService) static void
Sets the environment to use to read configuration to the default environment.static void
useEnvironment
(SpannerOptions.SpannerEnvironment environment) Sets the environment to use to read configuration.Methods inherited from class com.google.cloud.ServiceOptions
baseEquals, baseHashCode, defaultRetrySettings, getAppEngineAppId, getAppEngineProjectId, getAppEngineProjectIdFromAppId, getApplicationName, getClientLibToken, getClock, getCredentials, getDefaultProjectId, getDefaultRetrySettings, getFromServiceLoader, getGoogApiClientLibName, getGoogleCloudProjectId, getHost, getLibraryName, getLibraryVersion, getMergedHeaderProvider, getNoRetrySettings, getProjectId, getQuotaProjectId, getRetrySettings, getRpc, getScopedCredentials, getService, getServiceAccountProjectId, getTransportOptions, getUserAgent, newInstance, projectIdRequired
-
Field Details
-
CALL_CONTEXT_CONFIGURATOR_KEY
public static final io.grpc.Context.Key<SpannerOptions.CallContextConfigurator> CALL_CONTEXT_CONFIGURATOR_KEYContext key for theSpannerOptions.CallContextConfigurator
to use.
-
-
Method Details
-
createAsyncExecutorProvider
public static SpannerOptions.CloseableExecutorProvider createAsyncExecutorProvider(int poolSize, long keepAliveTime, TimeUnit unit) Creates aSpannerOptions.CloseableExecutorProvider
that can be used as anExecutorProvider
for the async API. TheExecutorProvider
will lazily create up to poolSize threads. The backing threads will automatically be shutdown if they have not been used during the keep-alive time. The backing threads are created as daemon threads.- Parameters:
poolSize
- the maximum number of threads to create in the poolkeepAliveTime
- the time that an unused thread in the pool should be kept aliveunit
- the time unit used for the keepAliveTime- Returns:
- a
SpannerOptions.CloseableExecutorProvider
that can be used forSpannerOptions.Builder.setAsyncExecutorProvider(CloseableExecutorProvider)
-
getDefaultInstance
Returns default instance ofSpannerOptions
. -
newBuilder
-
useEnvironment
Sets the environment to use to read configuration. The default will read configuration from environment variables. -
useDefaultEnvironment
public static void useDefaultEnvironment()Sets the environment to use to read configuration to the default environment. This will read configuration from environment variables. -
getDefaultProject
- Overrides:
getDefaultProject
in classcom.google.cloud.ServiceOptions<Spanner,
SpannerOptions>
-
getChannelProvider
public com.google.api.gax.rpc.TransportChannelProvider getChannelProvider() -
getChannelConfigurator
public com.google.api.core.ApiFunction<io.grpc.ManagedChannelBuilder,io.grpc.ManagedChannelBuilder> getChannelConfigurator() -
getInterceptorProvider
public com.google.api.gax.grpc.GrpcInterceptorProvider getInterceptorProvider() -
getNumChannels
public int getNumChannels() -
getTransportChannelExecutorThreadNameFormat
-
getSessionPoolOptions
-
getDatabaseRole
-
getSessionLabels
-
getSpannerStubSettings
-
getInstanceAdminStubSettings
-
getDatabaseAdminStubSettings
-
getPartitionedDmlTimeout
public org.threeten.bp.Duration getPartitionedDmlTimeout() -
isGrpcGcpExtensionEnabled
public boolean isGrpcGcpExtensionEnabled() -
getGrpcGcpOptions
public com.google.cloud.grpc.GcpManagedChannelOptions getGrpcGcpOptions() -
isAutoThrottleAdministrativeRequests
public boolean isAutoThrottleAdministrativeRequests() -
getRetryAdministrativeRequestsSettings
public com.google.api.gax.retrying.RetrySettings getRetryAdministrativeRequestsSettings() -
isTrackTransactionStarter
public boolean isTrackTransactionStarter() -
getCallCredentialsProvider
-
getCompressorName
-
isLeaderAwareRoutingEnabled
public boolean isLeaderAwareRoutingEnabled() -
getDefaultQueryOptions
Returns the default query options to use for the specific database. -
getAsyncExecutorProvider
-
getPrefetchChunks
public int getPrefetchChunks() -
getDefaultGrpcTransportOptions
public static com.google.cloud.grpc.GrpcTransportOptions getDefaultGrpcTransportOptions() -
getDefaultHost
- Overrides:
getDefaultHost
in classcom.google.cloud.ServiceOptions<Spanner,
SpannerOptions>
-
getScopes
- Specified by:
getScopes
in classcom.google.cloud.ServiceOptions<Spanner,
SpannerOptions>
-
getSpannerRpcV1
-
shouldRefreshService
- Overrides:
shouldRefreshService
in classcom.google.cloud.ServiceOptions<Spanner,
SpannerOptions> - Returns:
true
if the cached Spanner service instance isnull
or closed. This will cause the methodServiceOptions.getService()
to create a newSpannerRpc
instance when one is requested.
-
shouldRefreshRpc
protected boolean shouldRefreshRpc(com.google.cloud.ServiceRpc cachedRpc) - Overrides:
shouldRefreshRpc
in classcom.google.cloud.ServiceOptions<Spanner,
SpannerOptions> - Returns:
true
if the cachedServiceRpc
instance isnull
or closed. This will cause the methodServiceOptions.getRpc()
to create a newSpanner
instance when one is requested.
-
toBuilder
- Specified by:
toBuilder
in classcom.google.cloud.ServiceOptions<Spanner,
SpannerOptions>
-
getEndpoint
-