Class SpannerSettings (6.82.0)

public class SpannerSettings extends ClientSettings<SpannerSettings>

Settings class to configure an instance of SpannerClient.

The default instance has everything set to sensible defaults:

  • The default service address (spanner.googleapis.com) and default port (443) are used.
  • Credentials are acquired automatically through Application Default Credentials.
  • Retries are configured for idempotent methods but not for non-idempotent methods.

The builder of this class is recursive, so contained classes are themselves builders. When build() is called, the tree of builders is called to create the complete settings object.

For example, to set the RetrySettings of createSession:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 SpannerSettings.Builder spannerSettingsBuilder = SpannerSettings.newBuilder();
 spannerSettingsBuilder
     .createSessionSettings()
     .setRetrySettings(
         spannerSettingsBuilder
             .createSessionSettings()
             .getRetrySettings()
             .toBuilder()
             .setInitialRetryDelayDuration(Duration.ofSeconds(1))
             .setInitialRpcTimeoutDuration(Duration.ofSeconds(5))
             .setMaxAttempts(5)
             .setMaxRetryDelayDuration(Duration.ofSeconds(30))
             .setMaxRpcTimeoutDuration(Duration.ofSeconds(60))
             .setRetryDelayMultiplier(1.3)
             .setRpcTimeoutMultiplier(1.5)
             .setTotalTimeoutDuration(Duration.ofSeconds(300))
             .build());
 SpannerSettings spannerSettings = spannerSettingsBuilder.build();
 

Please refer to the Client Side Retry Guide for additional support in setting retries.

Inheritance

java.lang.Object > ClientSettings > SpannerSettings

Static Methods

create(SpannerStubSettings stub)

public static final SpannerSettings create(SpannerStubSettings stub)
Parameter
Name Description
stub SpannerStubSettings
Returns
Type Description
SpannerSettings
Exceptions
Type Description
IOException

defaultApiClientHeaderProviderBuilder()

public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder()
Returns
Type Description
Builder

defaultCredentialsProviderBuilder()

public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder()

Returns a builder for the default credentials for this service.

Returns
Type Description
Builder

defaultExecutorProviderBuilder()

public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder()

Returns a builder for the default ExecutorProvider for this service.

Returns
Type Description
Builder

defaultGrpcTransportProviderBuilder()

public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder()

Returns a builder for the default gRPC ChannelProvider for this service.

Returns
Type Description
Builder

defaultHttpJsonTransportProviderBuilder()

public static InstantiatingHttpJsonChannelProvider.Builder defaultHttpJsonTransportProviderBuilder()

Returns a builder for the default REST ChannelProvider for this service.

Returns
Type Description
Builder

defaultTransportChannelProvider()

public static TransportChannelProvider defaultTransportChannelProvider()
Returns
Type Description
TransportChannelProvider

getDefaultEndpoint()

public static String getDefaultEndpoint()

Returns the default service endpoint.

Returns
Type Description
String

getDefaultServiceScopes()

public static List<String> getDefaultServiceScopes()

Returns the default service scopes.

Returns
Type Description
List<String>

newBuilder()

public static SpannerSettings.Builder newBuilder()

Returns a new gRPC builder for this class.

Returns
Type Description
SpannerSettings.Builder

newBuilder(ClientContext clientContext)

public static SpannerSettings.Builder newBuilder(ClientContext clientContext)

Returns a new builder for this class.

Parameter
Name Description
clientContext ClientContext
Returns
Type Description
SpannerSettings.Builder

newHttpJsonBuilder()

public static SpannerSettings.Builder newHttpJsonBuilder()

Returns a new REST builder for this class.

Returns
Type Description
SpannerSettings.Builder

Constructors

SpannerSettings(SpannerSettings.Builder settingsBuilder)

protected SpannerSettings(SpannerSettings.Builder settingsBuilder)
Parameter
Name Description
settingsBuilder SpannerSettings.Builder

Methods

batchCreateSessionsSettings()

public UnaryCallSettings<BatchCreateSessionsRequest,BatchCreateSessionsResponse> batchCreateSessionsSettings()

Returns the object with the settings used for calls to batchCreateSessions.

Returns
Type Description
UnaryCallSettings<BatchCreateSessionsRequest,BatchCreateSessionsResponse>

batchWriteSettings()

public ServerStreamingCallSettings<BatchWriteRequest,BatchWriteResponse> batchWriteSettings()

Returns the object with the settings used for calls to batchWrite.

Returns
Type Description
ServerStreamingCallSettings<BatchWriteRequest,BatchWriteResponse>

beginTransactionSettings()

public UnaryCallSettings<BeginTransactionRequest,Transaction> beginTransactionSettings()

Returns the object with the settings used for calls to beginTransaction.

Returns
Type Description
UnaryCallSettings<BeginTransactionRequest,Transaction>

commitSettings()

public UnaryCallSettings<CommitRequest,CommitResponse> commitSettings()

Returns the object with the settings used for calls to commit.

Returns
Type Description
UnaryCallSettings<CommitRequest,CommitResponse>

createSessionSettings()

public UnaryCallSettings<CreateSessionRequest,Session> createSessionSettings()

Returns the object with the settings used for calls to createSession.

Returns
Type Description
UnaryCallSettings<CreateSessionRequest,Session>

deleteSessionSettings()

public UnaryCallSettings<DeleteSessionRequest,Empty> deleteSessionSettings()

Returns the object with the settings used for calls to deleteSession.

Returns
Type Description
UnaryCallSettings<DeleteSessionRequest,Empty>

executeBatchDmlSettings()

public UnaryCallSettings<ExecuteBatchDmlRequest,ExecuteBatchDmlResponse> executeBatchDmlSettings()

Returns the object with the settings used for calls to executeBatchDml.

Returns
Type Description
UnaryCallSettings<ExecuteBatchDmlRequest,ExecuteBatchDmlResponse>

executeSqlSettings()

public UnaryCallSettings<ExecuteSqlRequest,ResultSet> executeSqlSettings()

Returns the object with the settings used for calls to executeSql.

Returns
Type Description
UnaryCallSettings<ExecuteSqlRequest,ResultSet>

executeStreamingSqlSettings()

public ServerStreamingCallSettings<ExecuteSqlRequest,PartialResultSet> executeStreamingSqlSettings()

Returns the object with the settings used for calls to executeStreamingSql.

Returns
Type Description
ServerStreamingCallSettings<ExecuteSqlRequest,PartialResultSet>

getSessionSettings()

public UnaryCallSettings<GetSessionRequest,Session> getSessionSettings()

Returns the object with the settings used for calls to getSession.

Returns
Type Description
UnaryCallSettings<GetSessionRequest,Session>

listSessionsSettings()

public PagedCallSettings<ListSessionsRequest,ListSessionsResponse,SpannerClient.ListSessionsPagedResponse> listSessionsSettings()

Returns the object with the settings used for calls to listSessions.

Returns
Type Description
PagedCallSettings<ListSessionsRequest,ListSessionsResponse,ListSessionsPagedResponse>

partitionQuerySettings()

public UnaryCallSettings<PartitionQueryRequest,PartitionResponse> partitionQuerySettings()

Returns the object with the settings used for calls to partitionQuery.

Returns
Type Description
UnaryCallSettings<PartitionQueryRequest,PartitionResponse>

partitionReadSettings()

public UnaryCallSettings<PartitionReadRequest,PartitionResponse> partitionReadSettings()

Returns the object with the settings used for calls to partitionRead.

Returns
Type Description
UnaryCallSettings<PartitionReadRequest,PartitionResponse>

readSettings()

public UnaryCallSettings<ReadRequest,ResultSet> readSettings()

Returns the object with the settings used for calls to read.

Returns
Type Description
UnaryCallSettings<ReadRequest,ResultSet>

rollbackSettings()

public UnaryCallSettings<RollbackRequest,Empty> rollbackSettings()

Returns the object with the settings used for calls to rollback.

Returns
Type Description
UnaryCallSettings<RollbackRequest,Empty>

streamingReadSettings()

public ServerStreamingCallSettings<ReadRequest,PartialResultSet> streamingReadSettings()

Returns the object with the settings used for calls to streamingRead.

Returns
Type Description
ServerStreamingCallSettings<ReadRequest,PartialResultSet>

toBuilder()

public SpannerSettings.Builder toBuilder()

Returns a builder containing all the values of this settings class.

Returns
Type Description
SpannerSettings.Builder
Overrides