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
public class SpannerOptions extends com.google.cloud.ServiceOptions<Spanner,SpannerOptions>
Options for the Cloud Spanner service.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SpannerOptions.Builder
Builder forSpannerOptions
instances.static interface
SpannerOptions.CallContextConfigurator
SpannerOptions.CallContextConfigurator
can be used to modify theApiCallContext
for one or more specific RPCs.static interface
SpannerOptions.CallCredentialsProvider
static interface
SpannerOptions.CloseableExecutorProvider
ExecutorProvider
that is used forAsyncResultSet
.static class
SpannerOptions.FixedCloseableExecutorProvider
Implementation ofSpannerOptions.CloseableExecutorProvider
that uses a fixed singleScheduledExecutorService
.static class
SpannerOptions.SpannerCallContextTimeoutConfigurator
Helper class to configure timeouts for specific Spanner RPCs.static interface
SpannerOptions.SpannerEnvironment
The environment to read configuration values from.
-
Field Summary
Fields Modifier and Type Field Description static io.grpc.Context.Key<SpannerOptions.CallContextConfigurator>
CALL_CONTEXT_CONFIGURATOR_KEY
Context key for theSpannerOptions.CallContextConfigurator
to use.
-
Method Summary
-
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 Detail
-
CALL_CONTEXT_CONFIGURATOR_KEY
public static final io.grpc.Context.Key<SpannerOptions.CallContextConfigurator> CALL_CONTEXT_CONFIGURATOR_KEY
Context key for theSpannerOptions.CallContextConfigurator
to use.
-
-
Method Detail
-
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
public static SpannerOptions getDefaultInstance()
Returns default instance ofSpannerOptions
.
-
newBuilder
public static SpannerOptions.Builder newBuilder()
-
useEnvironment
public static void useEnvironment(SpannerOptions.SpannerEnvironment environment)
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
protected String 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
public String getTransportChannelExecutorThreadNameFormat()
-
getSessionPoolOptions
public SessionPoolOptions getSessionPoolOptions()
-
getSpannerStubSettings
public SpannerStubSettings getSpannerStubSettings()
-
getInstanceAdminStubSettings
public InstanceAdminStubSettings getInstanceAdminStubSettings()
-
getDatabaseAdminStubSettings
public DatabaseAdminStubSettings 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
public SpannerOptions.CallCredentialsProvider getCallCredentialsProvider()
-
getCompressorName
public String getCompressorName()
-
getDefaultQueryOptions
public ExecuteSqlRequest.QueryOptions getDefaultQueryOptions(DatabaseId databaseId)
Returns the default query options to use for the specific database.
-
getAsyncExecutorProvider
public SpannerOptions.CloseableExecutorProvider getAsyncExecutorProvider()
-
getPrefetchChunks
public int getPrefetchChunks()
-
getDefaultGrpcTransportOptions
public static com.google.cloud.grpc.GrpcTransportOptions getDefaultGrpcTransportOptions()
-
getDefaultHost
protected String getDefaultHost()
- Overrides:
getDefaultHost
in classcom.google.cloud.ServiceOptions<Spanner,SpannerOptions>
-
getScopes
public Set<String> getScopes()
- Specified by:
getScopes
in classcom.google.cloud.ServiceOptions<Spanner,SpannerOptions>
-
getSpannerRpcV1
protected SpannerRpc getSpannerRpcV1()
-
shouldRefreshService
protected boolean shouldRefreshService(Spanner cachedService)
- 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
public SpannerOptions.Builder toBuilder()
- Specified by:
toBuilder
in classcom.google.cloud.ServiceOptions<Spanner,SpannerOptions>
-
getEndpoint
public String getEndpoint()
-
-