# Class SpannerOptions (6.118.0)

6.118.0 (latest) 6.116.0 6.111.1 6.108.0 6.107.0 6.103.0 6.102.1 6.101.1 6.100.0 6.99.0 6.98.1 6.97.1 6.96.1 6.95.1 6.94.0 6.93.0 6.89.0 6.88.0 6.87.0 6.86.0 6.85.0 6.83.0 6.82.0 6.80.1 6.79.0 6.77.0 6.74.1 6.72.0 6.71.0 6.69.0 6.68.0 6.66.0 6.65.1 6.62.0 6.60.0 6.58.0 6.57.0 6.56.0 6.55.0 6.54.0 6.53.0 6.52.1 6.51.0 6.50.1 6.49.0 6.25.1 6.24.0 6.23.4 6.22.0 6.21.2 6.20.0 6.19.1 6.18.0 6.17.4 6.14.1

    public class SpannerOptions extends ServiceOptions<Spanner,SpannerOptions>

Options for the Cloud Spanner service.

## Inheritance

[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \> com.google.cloud.ServiceOptions \> SpannerOptions

## Inherited Members

com.google.cloud.ServiceOptions.\<B\>toBuilder() com.google.cloud.ServiceOptions.\<T\>getFromServiceLoader(java.lang.Class\<? extends T\>,T) com.google.cloud.ServiceOptions.\<T\>newInstance(java.lang.String) com.google.cloud.ServiceOptions.baseEquals(com.google.cloud.ServiceOptions\<?,?\>) com.google.cloud.ServiceOptions.baseHashCode() com.google.cloud.ServiceOptions.defaultRetrySettings() com.google.cloud.ServiceOptions.getApiTracerFactory() com.google.cloud.ServiceOptions.getAppEngineAppId() com.google.cloud.ServiceOptions.getAppEngineProjectId() com.google.cloud.ServiceOptions.getAppEngineProjectIdFromAppId() com.google.cloud.ServiceOptions.getApplicationName() com.google.cloud.ServiceOptions.getClientLibToken() com.google.cloud.ServiceOptions.getClock() com.google.cloud.ServiceOptions.getCredentials() com.google.cloud.ServiceOptions.getDefaultHost() com.google.cloud.ServiceOptions.getDefaultProject() com.google.cloud.ServiceOptions.getDefaultProjectId() com.google.cloud.ServiceOptions.getDefaultRetrySettings() com.google.cloud.ServiceOptions.getGoogApiClientLibName() com.google.cloud.ServiceOptions.getGoogleCloudProjectId() com.google.cloud.ServiceOptions.getHost() com.google.cloud.ServiceOptions.getLibraryName() com.google.cloud.ServiceOptions.getLibraryVersion() com.google.cloud.ServiceOptions.getMergedHeaderProvider(com.google.api.gax.rpc.HeaderProvider) com.google.cloud.ServiceOptions.getNoRetrySettings() com.google.cloud.ServiceOptions.getProjectId() com.google.cloud.ServiceOptions.getQuotaProjectId() com.google.cloud.ServiceOptions.getResolvedApiaryHost(java.lang.String) com.google.cloud.ServiceOptions.getResolvedHost(java.lang.String) com.google.cloud.ServiceOptions.getRetrySettings() com.google.cloud.ServiceOptions.getRpc() com.google.cloud.ServiceOptions.getScopedCredentials() com.google.cloud.ServiceOptions.getScopes() com.google.cloud.ServiceOptions.getService() com.google.cloud.ServiceOptions.getServiceAccountProjectId() com.google.cloud.ServiceOptions.getTransportOptions() com.google.cloud.ServiceOptions.getUniverseDomain() com.google.cloud.ServiceOptions.getUserAgent() com.google.cloud.ServiceOptions.hasValidUniverseDomain() com.google.cloud.ServiceOptions.projectIdRequired() com.google.cloud.ServiceOptions.shouldRefreshRpc(com.google.cloud.ServiceRpc) com.google.cloud.ServiceOptions.shouldRefreshService(ServiceT) [Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) [Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) [Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) [Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) [Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) [Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) [Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) [Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) [Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) [Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) [Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)

## Static Fields

### CALL_CONTEXT_CONFIGURATOR_KEY

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

Context key for the [CallContextConfigurator](https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.SpannerOptions.CallContextConfigurator) to use.

| **Field Value** ||
|---|---|
| **Type** | **Description** |
| `io.grpc.Context.Key<https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.SpannerOptions.CallContextConfigurator>` |   |

### DEFAULT_DYNAMIC_POOL_AFFINITY_KEY_LIFETIME

    public static final Duration DEFAULT_DYNAMIC_POOL_AFFINITY_KEY_LIFETIME

Default affinity key lifetime for dynamic channel pool. This is how long to keep an affinity
key after its last use. Zero means keeping keys forever. Default is 10 minutes, which is
sufficient to ensure that requests within a single transaction use the same channel.

| **Field Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/time/Duration.html` |   |

### DEFAULT_DYNAMIC_POOL_CLEANUP_INTERVAL

    public static final Duration DEFAULT_DYNAMIC_POOL_CLEANUP_INTERVAL

Default cleanup interval for dynamic channel pool affinity keys. This is how frequently the
affinity key cleanup process runs. Default is 1 minute (1/10 of default affinity key lifetime).

| **Field Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/time/Duration.html` |   |

### DEFAULT_DYNAMIC_POOL_INITIAL_SIZE

    public static final int DEFAULT_DYNAMIC_POOL_INITIAL_SIZE

Default initial number of channels for dynamic pool.

| **Field Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### DEFAULT_DYNAMIC_POOL_MAX_CHANNELS

    public static final int DEFAULT_DYNAMIC_POOL_MAX_CHANNELS

Default max number of channels for dynamic pool.

| **Field Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### DEFAULT_DYNAMIC_POOL_MAX_RPC

    public static final int DEFAULT_DYNAMIC_POOL_MAX_RPC

Default max concurrent RPCs per channel before triggering scale up.

| **Field Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### DEFAULT_DYNAMIC_POOL_MIN_CHANNELS

    public static final int DEFAULT_DYNAMIC_POOL_MIN_CHANNELS

Default min number of channels for dynamic pool.

| **Field Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### DEFAULT_DYNAMIC_POOL_MIN_RPC

    public static final int DEFAULT_DYNAMIC_POOL_MIN_RPC

Default min concurrent RPCs per channel for scale down check.

| **Field Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### DEFAULT_DYNAMIC_POOL_SCALE_DOWN_INTERVAL

    public static final Duration DEFAULT_DYNAMIC_POOL_SCALE_DOWN_INTERVAL

Default scale down check interval.

| **Field Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/time/Duration.html` |   |

### DEFAULT_SPANNER_OMNI_INSTANCE_ID

    public static final String DEFAULT_SPANNER_OMNI_INSTANCE_ID

| **Field Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

### SPANNER_OMNI_PROJECT_ID

    public static final String SPANNER_OMNI_PROJECT_ID

| **Field Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

## 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](https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.core.ExecutorProvider.html) for
the async API. The [ExecutorProvider](https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.core.ExecutorProvider.html) 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` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` the maximum number of threads to create in the pool |
| `keepAliveTime` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` the time that an unused thread in the pool should be kept alive |
| `unit` | `https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/TimeUnit.html` the time unit used for the keepAliveTime |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.SpannerOptions.CloseableExecutorProvider` | a CloseableExecutorProvider that can be used for SpannerOptions.Builder#setAsyncExecutorProvider(CloseableExecutorProvider) |

### createDefaultDynamicChannelPoolOptions()

    public static GcpManagedChannelOptions.GcpChannelPoolOptions createDefaultDynamicChannelPoolOptions()

Creates a GcpChannelPoolOptions instance with Spanner-specific defaults for dynamic
channel pooling. These defaults are optimized for typical Spanner workloads.

Default values:

- Max size: {@value #DEFAULT_DYNAMIC_POOL_MAX_CHANNELS}
- Min size: {@value #DEFAULT_DYNAMIC_POOL_MIN_CHANNELS}
- Initial size: {@value #DEFAULT_DYNAMIC_POOL_INITIAL_SIZE}
- Max RPC per channel: {@value #DEFAULT_DYNAMIC_POOL_MAX_RPC}
- Min RPC per channel: {@value #DEFAULT_DYNAMIC_POOL_MIN_RPC}
- Scale down interval: 3 minutes
- Affinity key lifetime: 10 minutes
- Cleanup interval: 1 minute

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `com.google.cloud.grpc.GcpManagedChannelOptions.GcpChannelPoolOptions` | a new GcpChannelPoolOptions instance with Spanner defaults |

### disableOpenCensusMetrics()

    public static void disableOpenCensusMetrics()

Disables OpenCensus metrics. Disable OpenCensus metrics before creating Spanner client.

### enableOpenCensusTraces()

    public static void enableOpenCensusTraces()

> [!WARNING]
> **Obsolete**
>
> *The OpenCensus project is deprecated. Use enableOpenTelemetryTraces to switch to OpenTelemetry traces*
>
> This feature is stable for usage in this major version, but may be deprecated in a future release.

Enables OpenCensus traces. Enabling OpenCensus traces will disable OpenTelemetry traces.

### enableOpenTelemetryMetrics()

    public static void enableOpenTelemetryMetrics()

Enables OpenTelemetry metrics. Enable OpenTelemetry metrics before creating Spanner client.

### enableOpenTelemetryTraces()

    public static void enableOpenTelemetryTraces()

Enables OpenTelemetry traces. Enabling OpenTelemetry traces will disable OpenCensus traces. By
default, OpenCensus traces are enabled.

### getActiveTracingFramework()

    public static SpannerOptions.TracingFramework getActiveTracingFramework()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `com.google.cloud.spanner.SpannerOptions.TracingFramework` |   |

### getDefaultGrpcTransportOptions()

    public static GrpcTransportOptions getDefaultGrpcTransportOptions()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `com.google.cloud.grpc.GrpcTransportOptions` |   |

### getDefaultInstance()

    public static SpannerOptions getDefaultInstance()

Returns default instance of `SpannerOptions`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.SpannerOptions` |   |

### getDefaultSpannerOmniCredentialsFromSysEnv()

    public static GoogleCredentials getDefaultSpannerOmniCredentialsFromSysEnv()

> [!WARNING]
> **Internal Only**: This feature is not stable for application use.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `com.google.auth.oauth2.GoogleCredentials` |   |

### isEnabledOpenCensusMetrics()

    public static boolean isEnabledOpenCensusMetrics()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### isEnabledOpenTelemetryMetrics()

    public static boolean isEnabledOpenTelemetryMetrics()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### newBuilder()

    public static SpannerOptions.Builder newBuilder()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.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** ||
|---|---|
| **Name** | **Description** |
| `environment` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.SpannerOptions.SpannerEnvironment` |

## Constructors

### SpannerOptions(SpannerOptions.Builder builder)

    protected SpannerOptions(SpannerOptions.Builder builder)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `builder` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.SpannerOptions.Builder` |

## Methods

### enablegRPCMetrics(InstantiatingGrpcChannelProvider.Builder channelProviderBuilder)

    public void enablegRPCMetrics(InstantiatingGrpcChannelProvider.Builder channelProviderBuilder)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `channelProviderBuilder` | `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.Builder.html` |

### getApiTracerFactory()

    public ApiTracerFactory getApiTracerFactory()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.tracing.ApiTracerFactory.html` |   |

**Overrides** com.google.cloud.ServiceOptions.getApiTracerFactory()

### getApiTracerFactory(boolean isAdminClient, boolean isEmulatorEnabled)

    public ApiTracerFactory getApiTracerFactory(boolean isAdminClient, boolean isEmulatorEnabled)

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `isAdminClient` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |
| `isEmulatorEnabled` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.tracing.ApiTracerFactory.html` |   |

### getAsyncExecutorProvider()

    public SpannerOptions.CloseableExecutorProvider getAsyncExecutorProvider()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.SpannerOptions.CloseableExecutorProvider` |   |

### getAutoTaggingPackages()

    public List<String> getAutoTaggingPackages()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/List.html<https://docs.oracle.com/javase/8/docs/api/java/lang/String.html>` |   |

### getAutoTaggingTracerLimit()

    public int getAutoTaggingTracerLimit()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### getBuiltInOpenTelemetry()

    public OpenTelemetry getBuiltInOpenTelemetry()

> [!WARNING]
> **Internal Only**: This feature is not stable for application use.

Returns the internal OpenTelemetry instance used for built-in metrics.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `io.opentelemetry.api.OpenTelemetry` |   |

### getCallCredentialsProvider()

    public SpannerOptions.CallCredentialsProvider getCallCredentialsProvider()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.SpannerOptions.CallCredentialsProvider` |   |

### getChannelConfigurator()

    public ApiFunction<ManagedChannelBuilder,ManagedChannelBuilder> getChannelConfigurator()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/api-common/latest/com.google.api.core.ApiFunction.html<io.grpc.ManagedChannelBuilder,io.grpc.ManagedChannelBuilder>` |   |

### getChannelEndpointCacheFactory()

    public ChannelEndpointCacheFactory getChannelEndpointCacheFactory()

> [!WARNING]
> **Internal Only**: This feature is not stable for application use.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.spi.v1.ChannelEndpointCacheFactory` |   |

### getChannelProvider()

    public TransportChannelProvider getChannelProvider()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.rpc.TransportChannelProvider.html` |   |

### getClientContext()

    public RequestOptions.ClientContext getClientContext()

Returns the default [RequestOptions.ClientContext](https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.spanner.v1.RequestOptions.ClientContext) for this [SpannerOptions](https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.SpannerOptions).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.spanner.v1.RequestOptions.ClientContext` |   |

### getCompressorName()

    public String getCompressorName()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

### getDatabaseAdminStubSettings()

    public DatabaseAdminStubSettings getDatabaseAdminStubSettings()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.admin.database.v1.stub.DatabaseAdminStubSettings` |   |

### getDatabaseRole()

    public String getDatabaseRole()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

### getDecodeMode()

    public DecodeMode getDecodeMode()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.DecodeMode` |   |

### getDefaultHost()

    protected String getDefaultHost()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

**Overrides** com.google.cloud.ServiceOptions.getDefaultHost()

### getDefaultProject()

    protected String getDefaultProject()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

**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` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.DatabaseId` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.spanner.v1.ExecuteSqlRequest.QueryOptions` |   |

### getDefaultTransactionOptions()

    public TransactionOptions getDefaultTransactionOptions()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.spanner.v1.TransactionOptions` |   |

### getDirectedReadOptions()

    public DirectedReadOptions getDirectedReadOptions()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.spanner.v1.DirectedReadOptions` |   |

### getEndpoint()

    public String getEndpoint()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

### getGcpChannelPoolOptions()

    public GcpManagedChannelOptions.GcpChannelPoolOptions getGcpChannelPoolOptions()

Returns the channel pool options for dynamic channel pooling. If no options were explicitly
set, returns the Spanner-specific defaults.
See Also: [#createDefaultDynamicChannelPoolOptions()](https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.SpannerOptions#com_google_cloud_spanner_SpannerOptions_createDefaultDynamicChannelPoolOptions__)

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `com.google.cloud.grpc.GcpManagedChannelOptions.GcpChannelPoolOptions` |   |

### getGrpcGcpOptions()

    public GcpManagedChannelOptions getGrpcGcpOptions()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `com.google.cloud.grpc.GcpManagedChannelOptions` |   |

### getInstanceAdminStubSettings()

    public InstanceAdminStubSettings getInstanceAdminStubSettings()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.admin.instance.v1.stub.InstanceAdminStubSettings` |   |

### getInterceptorProvider()

    public GrpcInterceptorProvider getInterceptorProvider()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.grpc.GrpcInterceptorProvider.html` |   |

### getNumChannels()

    public int getNumChannels()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### getOpenTelemetry()

    public OpenTelemetry getOpenTelemetry()

Returns an instance of OpenTelemetry. If OpenTelemetry object is not set via SpannerOptions
then GlobalOpenTelemetry will be used as fallback.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `io.opentelemetry.api.OpenTelemetry` |   |

### getPartitionedDmlTimeout()

    public Duration getPartitionedDmlTimeout()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `org.threeten.bp.Duration` |   |

### getPartitionedDmlTimeoutDuration()

    public Duration getPartitionedDmlTimeoutDuration()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/time/Duration.html` |   |

### getPrefetchChunks()

    public int getPrefetchChunks()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### getRetryAdministrativeRequestsSettings()

    public RetrySettings getRetryAdministrativeRequestsSettings()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.retrying.RetrySettings.html` |   |

### getScopes()

    public Set<String> getScopes()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/Set.html<https://docs.oracle.com/javase/8/docs/api/java/lang/String.html>` |   |

**Overrides** com.google.cloud.ServiceOptions.getScopes()

### getSessionLabels()

    public Map<String,String> getSessionLabels()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/Map.html<https://docs.oracle.com/javase/8/docs/api/java/lang/String.html,https://docs.oracle.com/javase/8/docs/api/java/lang/String.html>` |   |

### getSessionPoolOptions()

    public SessionPoolOptions getSessionPoolOptions()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.SessionPoolOptions` |   |

### getSpannerRpcV1()

    protected SpannerRpc getSpannerRpcV1()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.spi.v1.SpannerRpc` |   |

### getSpannerStubSettings()

    public SpannerStubSettings getSpannerStubSettings()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.v1.stub.SpannerStubSettings` |   |

### getTransportChannelExecutorThreadNameFormat()

    public String getTransportChannelExecutorThreadNameFormat()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

### isAttemptDirectPath() (deprecated)

    public boolean isAttemptDirectPath()

> [!WARNING]
> **Obsolete**
>
> *Use isEnableDirectAccess() instead*
>
> This feature is stable for usage in this major version, but may be deprecated in a future release.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### isAutoTaggingEnabled()

    public boolean isAutoTaggingEnabled()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### isAutoThrottleAdministrativeRequests()

    public boolean isAutoThrottleAdministrativeRequests()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### isDynamicChannelPoolEnabled()

    public boolean isDynamicChannelPoolEnabled()

Returns whether dynamic channel pooling is enabled. Dynamic channel pooling is disabled by
default. Use Builder#enableDynamicChannelPool() to explicitly enable it. Note that
calling Builder#setNumChannels(int) will disable dynamic channel pooling even if it was
explicitly enabled.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### isEnableApiTracing()

    public boolean isEnableApiTracing()

Returns true if an [com.google.api.gax.tracing.ApiTracer](https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.tracing.ApiTracer.html) should be created and set on
the Spanner client. Enabling this only has effect if an OpenTelemetry or OpenCensus trace
exporter has been configured.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### isEnableBuiltInMetrics()

    public boolean isEnableBuiltInMetrics()

Returns true if an com.google.api.gax.tracing.MetricsTracer should be created and set
on the Spanner client.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### isEnableDirectAccess()

    public Boolean isEnableDirectAccess()

> [!WARNING]
> **Beta**
>
> This feature is covered by the [Pre-GA Offerings Terms](https://docs.cloud.google.com/terms/service-terms#1) of the Terms of Service. Pre-GA libraries might have limited support, and changes to pre-GA libraries might not be compatible with other pre-GA versions. For more information, see the launch stage descriptions.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/Boolean.html` |   |

### isEnableExtendedTracing()

    public boolean isEnableExtendedTracing()

Returns whether extended OpenTelemetry tracing is enabled. Enabling this option will add the
following additional attributes to the traces that are generated by the client:

- db.statement: Contains the SQL statement that is being executed.
- thread.name: The name of the thread that executes the statement.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### isEnableGcpFallback()

    public Boolean isEnableGcpFallback()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/Boolean.html` |   |

### isEnableLocationApi()

    public boolean isEnableLocationApi()

> [!WARNING]
> **Internal Only**: This feature is not stable for application use.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### isEndToEndTracingEnabled()

    public boolean isEndToEndTracingEnabled()

Returns whether end to end tracing is enabled. If this option is enabled then trace spans will
be created at the Spanner layer.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### isGrpcGcpExtensionEnabled()

    public boolean isGrpcGcpExtensionEnabled()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### isGrpcGcpOtelMetricsEnabled()

    public boolean isGrpcGcpOtelMetricsEnabled()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### isLeaderAwareRoutingEnabled()

    public boolean isLeaderAwareRoutingEnabled()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### isTrackTransactionStarter()

    public boolean isTrackTransactionStarter()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### isUseVirtualThreads()

    public boolean isUseVirtualThreads()

> [!WARNING]
> **Beta**
>
> This feature is covered by the [Pre-GA Offerings Terms](https://docs.cloud.google.com/terms/service-terms#1) of the Terms of Service. Pre-GA libraries might have limited support, and changes to pre-GA libraries might not be compatible with other pre-GA versions. For more information, see the launch stage descriptions.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### shouldRefreshRpc(ServiceRpc cachedRpc)

    protected boolean shouldRefreshRpc(ServiceRpc cachedRpc)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `cachedRpc` | `com.google.cloud.ServiceRpc` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | `true` if the cached ServiceRpc instance is `null` or closed. This will cause the method #getRpc() to create a new [Spanner](https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.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` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.Spanner` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | `true` if the cached Spanner service instance is `null` or closed. This will cause the method #getService() to create a new [SpannerRpc](https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.spi.v1.SpannerRpc) instance when one is requested. |

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

### toBuilder()

    public SpannerOptions.Builder toBuilder()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.SpannerOptions.Builder` |   |

**Overrides** com.google.cloud.ServiceOptions.\<B\>toBuilder()