1

Is com.google.cloud.datastore.Datastore thread safe? More specifically, can one instance of Datastore be shared by multiple threads and can they all concurrently read from/write to the Cloud Datastore?

In other words, if I'm building a Web Application that accesses the Cloud Datastore, do I need a single instance of the Datastore object or a pool of Datastore objects (just like JDBC connections to an RDBMS)?

The API in question is http://googlecloudplatform.github.io/google-cloud-java/0.3.0/apidocs/.

Ed Davisson
  • 2,927
  • 11
  • 11
Sai Pullabhotla
  • 2,207
  • 17
  • 17

1 Answers1

2

Yes, com.google.cloud.datastore.Datastore is thread-safe. We will make the docs clear about it.

ozarov
  • 1,051
  • 6
  • 7
  • Great, thanks! Is there a documentation or can you provide some additional information on how the Datastore objects maintains/manages connections to the Cloud Datastore. I mean, does it limit the max active connections, is there a possibility of queuing requests under high load, etc? – Sai Pullabhotla Sep 09 '16 at 22:15
  • No, it does not. However that may change when the SPI/transport layer would change to gRPC and async support would be provided. Feel free to create an issue in https://github.com/GoogleCloudPlatform/google-cloud-java to make that clear as well (and update it when gRPC is used). – ozarov Sep 27 '16 at 15:59