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 classSpannerOptions.BuilderBuilder forSpannerOptionsinstances.static interfaceSpannerOptions.CallContextConfiguratorSpannerOptions.CallContextConfiguratorcan be used to modify theApiCallContextfor one or more specific RPCs.static interfaceSpannerOptions.CallCredentialsProviderstatic interfaceSpannerOptions.CloseableExecutorProviderExecutorProviderthat is used forAsyncResultSet.static classSpannerOptions.FixedCloseableExecutorProviderImplementation ofSpannerOptions.CloseableExecutorProviderthat uses a fixed singleScheduledExecutorService.static classSpannerOptions.SpannerCallContextTimeoutConfiguratorHelper class to configure timeouts for specific Spanner RPCs.static interfaceSpannerOptions.SpannerEnvironmentThe environment to read configuration values from.
-
Field Summary
Fields Modifier and Type Field Description static io.grpc.Context.Key<SpannerOptions.CallContextConfigurator>CALL_CONTEXT_CONFIGURATOR_KEYContext key for theSpannerOptions.CallContextConfiguratorto 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.CallContextConfiguratorto use.
-
-
Method Detail
-
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
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:
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
public String getTransportChannelExecutorThreadNameFormat()
-
getSessionPoolOptions
public SessionPoolOptions getSessionPoolOptions()
-
getDatabaseRole
public String getDatabaseRole()
-
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:
getDefaultHostin classcom.google.cloud.ServiceOptions<Spanner,SpannerOptions>
-
getScopes
public Set<String> getScopes()
- Specified by:
getScopesin classcom.google.cloud.ServiceOptions<Spanner,SpannerOptions>
-
getSpannerRpcV1
protected SpannerRpc getSpannerRpcV1()
-
shouldRefreshService
protected boolean shouldRefreshService(Spanner cachedService)
- 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
public SpannerOptions.Builder toBuilder()
- Specified by:
toBuilderin classcom.google.cloud.ServiceOptions<Spanner,SpannerOptions>
-
getEndpoint
public String getEndpoint()
-
-