public interface Spanner extends Service<SpannerOptions>
close()
when it is no
longer needed. Failure to do so may result in leaking session resources and exhausting session
quota.Modifier and Type | Method and Description |
---|---|
void |
close()
Closes all the clients associated with this instance and frees up all the resources.
|
BatchClient |
getBatchClient(DatabaseId db)
Returns a
BatchClient to do batch operations on Cloud Spanner databases. |
DatabaseAdminClient |
getDatabaseAdminClient()
Returns a
DatabaseAdminClient to do admin operations on Cloud Spanner databases. |
DatabaseClient |
getDatabaseClient(DatabaseId db)
Returns a
DatabaseClient for the given database. |
InstanceAdminClient |
getInstanceAdminClient()
Returns an
InstanceAdminClient to do admin operations on Cloud Spanner instances. |
getOptions
DatabaseAdminClient getDatabaseAdminClient()
DatabaseAdminClient
to do admin operations on Cloud Spanner databases.InstanceAdminClient getInstanceAdminClient()
InstanceAdminClient
to do admin operations on Cloud Spanner instances.DatabaseClient getDatabaseClient(DatabaseId db)
DatabaseClient
for the given database. It uses a pool of sessions to talk to
the database.BatchClient getBatchClient(DatabaseId db)
BatchClient
to do batch operations on Cloud Spanner databases. Batch client
is useful when one wants to read/query a large amount of data from Cloud
Spanner across multiple processes, even across different machines. It allows to create
partitions of Cloud Spanner database and then read/query over each partition independently
yet at the same snapshot.
For all other use cases, DatabaseClient
is more appropriate and performant.
void close()
Spanner
object, typically when your application shuts down. There is
a hard limit on number of sessions in Cloud Spanner and not calling this method can lead to
unused sessions piling up on the backend.Copyright © 2018 Google LLC. All rights reserved.