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
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder forSpannerOptionsinstances.static interfaceSpannerOptions.CallContextConfiguratorcan be used to modify theApiCallContextfor one or more specific RPCs.static interfaceInterface that can be used to provideCallCredentialstoSpannerOptions.static interfaceExecutorProviderthat is used forAsyncResultSet.static classImplementation ofSpannerOptions.CloseableExecutorProviderthat uses a fixed singleScheduledExecutorService.static classHelper class to configure timeouts for specific Spanner RPCs.static interfaceThe environment to read configuration values from. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final io.grpc.Context.Key<SpannerOptions.CallContextConfigurator>Context key for theSpannerOptions.CallContextConfiguratorto 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.CloseableExecutorProviderthat can be used as anExecutorProviderfor the async API.com.google.api.core.ApiFunction<io.grpc.ManagedChannelBuilder,io.grpc.ManagedChannelBuilder> com.google.api.gax.rpc.TransportChannelProviderstatic com.google.cloud.grpc.GrpcTransportOptionsprotected Stringstatic SpannerOptionsReturns default instance ofSpannerOptions.protected StringgetDefaultQueryOptions(DatabaseId databaseId) Returns the default query options to use for the specific database.com.google.cloud.grpc.GcpManagedChannelOptionscom.google.api.gax.grpc.GrpcInterceptorProviderintorg.threeten.bp.Durationintcom.google.api.gax.retrying.RetrySettingsprotected SpannerRpcbooleanbooleanbooleanbooleanstatic SpannerOptions.Builderprotected booleanshouldRefreshRpc(com.google.cloud.ServiceRpc cachedRpc) protected booleanshouldRefreshService(Spanner cachedService) static voidSets the environment to use to read configuration to the default environment.static voiduseEnvironment(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.CallContextConfiguratorto use.
-
-
Method Details
-
createAsyncExecutorProvider
public static SpannerOptions.CloseableExecutorProvider createAsyncExecutorProvider(int poolSize, long keepAliveTime, TimeUnit unit) Creates aSpannerOptions.CloseableExecutorProviderthat can be used as anExecutorProviderfor the async API. TheExecutorProviderwill 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.CloseableExecutorProviderthat 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:
getDefaultProjectin 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:
getDefaultHostin classcom.google.cloud.ServiceOptions<Spanner,SpannerOptions>
-
getScopes
- Specified by:
getScopesin classcom.google.cloud.ServiceOptions<Spanner,SpannerOptions>
-
getSpannerRpcV1
-
shouldRefreshService
- Overrides:
shouldRefreshServicein classcom.google.cloud.ServiceOptions<Spanner,SpannerOptions> - Returns:
trueif the cached Spanner service instance isnullor closed. This will cause the methodServiceOptions.getService()to create a newSpannerRpcinstance when one is requested.
-
shouldRefreshRpc
protected boolean shouldRefreshRpc(com.google.cloud.ServiceRpc cachedRpc) - Overrides:
shouldRefreshRpcin classcom.google.cloud.ServiceOptions<Spanner,SpannerOptions> - Returns:
trueif the cachedServiceRpcinstance isnullor closed. This will cause the methodServiceOptions.getRpc()to create a newSpannerinstance when one is requested.
-
toBuilder
- Specified by:
toBuilderin classcom.google.cloud.ServiceOptions<Spanner,SpannerOptions>
-
getEndpoint
-