Class SpannerOptions (6.50.0)

public class SpannerOptions extends ServiceOptions<Spanner,SpannerOptions>

Options for the Cloud Spanner service.

Inheritance

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

Static 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
TypeDescription
io.grpc.Context.Key<CallContextConfigurator>

Static 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
NameDescription
poolSizeint

the maximum number of threads to create in the pool

keepAliveTimelong

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

unitTimeUnit

the time unit used for the keepAliveTime

Returns
TypeDescription
SpannerOptions.CloseableExecutorProvider

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

getDefaultGrpcTransportOptions()

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

getDefaultInstance()

public static SpannerOptions getDefaultInstance()

Returns default instance of SpannerOptions.

Returns
TypeDescription
SpannerOptions

newBuilder()

public static SpannerOptions.Builder newBuilder()
Returns
TypeDescription
SpannerOptions.Builder

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
NameDescription
environmentSpannerOptions.SpannerEnvironment

Methods

getAsyncExecutorProvider()

public SpannerOptions.CloseableExecutorProvider getAsyncExecutorProvider()
Returns
TypeDescription
SpannerOptions.CloseableExecutorProvider

getCallCredentialsProvider()

public SpannerOptions.CallCredentialsProvider getCallCredentialsProvider()
Returns
TypeDescription
SpannerOptions.CallCredentialsProvider

getChannelConfigurator()

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

getChannelProvider()

public TransportChannelProvider getChannelProvider()
Returns
TypeDescription
TransportChannelProvider

getCompressorName()

public String getCompressorName()
Returns
TypeDescription
String

getDatabaseAdminStubSettings()

public DatabaseAdminStubSettings getDatabaseAdminStubSettings()
Returns
TypeDescription
DatabaseAdminStubSettings

getDatabaseRole()

public String getDatabaseRole()
Returns
TypeDescription
String

getDefaultHost()

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

getDefaultProject()

protected String getDefaultProject()
Returns
TypeDescription
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
NameDescription
databaseIdDatabaseId
Returns
TypeDescription
ExecuteSqlRequest.QueryOptions

getEndpoint()

public String getEndpoint()
Returns
TypeDescription
String

getGrpcGcpOptions()

public GcpManagedChannelOptions getGrpcGcpOptions()
Returns
TypeDescription
com.google.cloud.grpc.GcpManagedChannelOptions

getInstanceAdminStubSettings()

public InstanceAdminStubSettings getInstanceAdminStubSettings()
Returns
TypeDescription
InstanceAdminStubSettings

getInterceptorProvider()

public GrpcInterceptorProvider getInterceptorProvider()
Returns
TypeDescription
GrpcInterceptorProvider

getNumChannels()

public int getNumChannels()
Returns
TypeDescription
int

getPartitionedDmlTimeout()

public Duration getPartitionedDmlTimeout()
Returns
TypeDescription
org.threeten.bp.Duration

getPrefetchChunks()

public int getPrefetchChunks()
Returns
TypeDescription
int

getRetryAdministrativeRequestsSettings()

public RetrySettings getRetryAdministrativeRequestsSettings()
Returns
TypeDescription
RetrySettings

getScopes()

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

getSessionLabels()

public Map<String,String> getSessionLabels()
Returns
TypeDescription
Map<String,String>

getSessionPoolOptions()

public SessionPoolOptions getSessionPoolOptions()
Returns
TypeDescription
SessionPoolOptions

getSpannerRpcV1()

protected SpannerRpc getSpannerRpcV1()
Returns
TypeDescription
SpannerRpc

getSpannerStubSettings()

public SpannerStubSettings getSpannerStubSettings()
Returns
TypeDescription
SpannerStubSettings

getTransportChannelExecutorThreadNameFormat()

public String getTransportChannelExecutorThreadNameFormat()
Returns
TypeDescription
String

isAutoThrottleAdministrativeRequests()

public boolean isAutoThrottleAdministrativeRequests()
Returns
TypeDescription
boolean

isGrpcGcpExtensionEnabled()

public boolean isGrpcGcpExtensionEnabled()
Returns
TypeDescription
boolean

isLeaderAwareRoutingEnabled()

public boolean isLeaderAwareRoutingEnabled()
Returns
TypeDescription
boolean

isTrackTransactionStarter()

public boolean isTrackTransactionStarter()
Returns
TypeDescription
boolean

shouldRefreshRpc(ServiceRpc cachedRpc)

protected boolean shouldRefreshRpc(ServiceRpc cachedRpc)
Parameter
NameDescription
cachedRpccom.google.cloud.ServiceRpc
Returns
TypeDescription
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
NameDescription
cachedServiceSpanner
Returns
TypeDescription
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
TypeDescription
SpannerOptions.Builder
Overrides
com.google.cloud.ServiceOptions.<B>toBuilder()