Class SpannerOptions

public class SpannerOptions extends ServiceOptions<Spanner,SpannerOptions>

Options for the Cloud Spanner service.

Inheritance

java.lang.Object > com.google.cloud.ServiceOptions > SpannerOptions

Fields

CALL_CONTEXT_CONFIGURATOR_KEY

public static final Context.Key<SpannerOptions.CallContextConfigurator> CALL_CONTEXT_CONFIGURATOR_KEY

Context key for the CallContextConfigurator to use.

Field Value
Type Description
io.grpc.Context.Key<CallContextConfigurator>

Methods

createAsyncExecutorProvider(int poolSize, long keepAliveTime, TimeUnit unit)

public static SpannerOptions.CloseableExecutorProvider createAsyncExecutorProvider(int poolSize, long keepAliveTime, TimeUnit unit)

Creates a CloseableExecutorProvider that can be used as an ExecutorProvider for the async API. The ExecutorProvider 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
Name Description
poolSize int

the maximum number of threads to create in the pool

keepAliveTime long

the time that an unused thread in the pool should be kept alive

unit TimeUnit

the time unit used for the keepAliveTime

Returns
Type Description
SpannerOptions.CloseableExecutorProvider

a CloseableExecutorProvider that can be used for SpannerOptions.Builder#setAsyncExecutorProvider(CloseableExecutorProvider)

getAsyncExecutorProvider()

public SpannerOptions.CloseableExecutorProvider getAsyncExecutorProvider()
Returns
Type Description
SpannerOptions.CloseableExecutorProvider

getCallCredentialsProvider()

public SpannerOptions.CallCredentialsProvider getCallCredentialsProvider()
Returns
Type Description
SpannerOptions.CallCredentialsProvider

getChannelConfigurator()

public ApiFunction<ManagedChannelBuilder,ManagedChannelBuilder> getChannelConfigurator()
Returns
Type Description
ApiFunction<io.grpc.ManagedChannelBuilder,io.grpc.ManagedChannelBuilder>

getChannelProvider()

public TransportChannelProvider getChannelProvider()
Returns
Type Description
TransportChannelProvider

getCompressorName()

public String getCompressorName()
Returns
Type Description
String

getDatabaseAdminStubSettings()

public DatabaseAdminStubSettings getDatabaseAdminStubSettings()
Returns
Type Description
DatabaseAdminStubSettings

getDefaultGrpcTransportOptions()

public static GrpcTransportOptions getDefaultGrpcTransportOptions()
Returns
Type Description
com.google.cloud.grpc.GrpcTransportOptions

getDefaultHost()

protected String getDefaultHost()
Returns
Type Description
String
Overrides
com.google.cloud.ServiceOptions.getDefaultHost()

getDefaultInstance()

public static SpannerOptions getDefaultInstance()

Returns default instance of SpannerOptions.

Returns
Type Description
SpannerOptions

getDefaultProject()

protected String getDefaultProject()
Returns
Type Description
String
Overrides
com.google.cloud.ServiceOptions.getDefaultProject()

getDefaultQueryOptions(DatabaseId databaseId)

public ExecuteSqlRequest.QueryOptions getDefaultQueryOptions(DatabaseId databaseId)

Returns the default query options to use for the specific database.

Parameter
Name Description
databaseId DatabaseId
Returns
Type Description
ExecuteSqlRequest.QueryOptions

getEndpoint()

public String getEndpoint()
Returns
Type Description
String

getGrpcGcpOptions()

public GcpManagedChannelOptions getGrpcGcpOptions()
Returns
Type Description
com.google.cloud.grpc.GcpManagedChannelOptions

getInstanceAdminStubSettings()

public InstanceAdminStubSettings getInstanceAdminStubSettings()
Returns
Type Description
InstanceAdminStubSettings

getInterceptorProvider()

public GrpcInterceptorProvider getInterceptorProvider()
Returns
Type Description
GrpcInterceptorProvider

getNumChannels()

public int getNumChannels()
Returns
Type Description
int

getPartitionedDmlTimeout()

public Duration getPartitionedDmlTimeout()
Returns
Type Description
org.threeten.bp.Duration

getPrefetchChunks()

public int getPrefetchChunks()
Returns
Type Description
int

getRetryAdministrativeRequestsSettings()

public RetrySettings getRetryAdministrativeRequestsSettings()
Returns
Type Description
RetrySettings

getScopes()

public Set<String> getScopes()
Returns
Type Description
Set<String>
Overrides
com.google.cloud.ServiceOptions.getScopes()

getSessionLabels()

public Map<String,String> getSessionLabels()
Returns
Type Description
Map<String,String>

getSessionPoolOptions()

public SessionPoolOptions getSessionPoolOptions()
Returns
Type Description
SessionPoolOptions

getSpannerRpcV1()

protected SpannerRpc getSpannerRpcV1()
Returns
Type Description
SpannerRpc

getSpannerStubSettings()

public SpannerStubSettings getSpannerStubSettings()
Returns
Type Description
SpannerStubSettings

getTransportChannelExecutorThreadNameFormat()

public String getTransportChannelExecutorThreadNameFormat()
Returns
Type Description
String

isAutoThrottleAdministrativeRequests()

public boolean isAutoThrottleAdministrativeRequests()
Returns
Type Description
boolean

isGrpcGcpExtensionEnabled()

public boolean isGrpcGcpExtensionEnabled()
Returns
Type Description
boolean

isTrackTransactionStarter()

public boolean isTrackTransactionStarter()
Returns
Type Description
boolean

newBuilder()

public static SpannerOptions.Builder newBuilder()
Returns
Type Description
SpannerOptions.Builder

shouldRefreshRpc(ServiceRpc cachedRpc)

protected boolean shouldRefreshRpc(ServiceRpc cachedRpc)
Parameter
Name Description
cachedRpc com.google.cloud.ServiceRpc
Returns
Type Description
boolean

true if the cached ServiceRpc instance is null or closed. This will cause the method #getRpc() to create a new Spanner instance when one is requested.

Overrides
com.google.cloud.ServiceOptions.shouldRefreshRpc(com.google.cloud.ServiceRpc)

shouldRefreshService(Spanner cachedService)

protected boolean shouldRefreshService(Spanner cachedService)
Parameter
Name Description
cachedService Spanner
Returns
Type Description
boolean

true if the cached Spanner service instance is null or closed. This will cause the method #getService() to create a new SpannerRpc instance when one is requested.

Overrides
com.google.cloud.ServiceOptions.shouldRefreshService(ServiceT)

toBuilder()

public SpannerOptions.Builder toBuilder()
Returns
Type Description
SpannerOptions.Builder
Overrides
com.google.cloud.ServiceOptions.<B>toBuilder()

useDefaultEnvironment()

public static void useDefaultEnvironment()

Sets the environment to use to read configuration to the default environment. This will read configuration from environment variables.

useEnvironment(SpannerOptions.SpannerEnvironment environment)

public static void useEnvironment(SpannerOptions.SpannerEnvironment environment)

Sets the environment to use to read configuration. The default will read configuration from environment variables.

Parameter
Name Description
environment SpannerOptions.SpannerEnvironment