开发者

Blocking concurrent access to App Engine datastore

I'm building an application on Google App Engine that uses the datastore to store information about the current state of the server. When an Android device queries the server, a servlet gets an Entity from the datastore, modifies it, and puts it back into the datastore to update the datastore entry.

However, sometimes while one instance of the servlet has gotten the data from the datastore, another instance of the servlet does the same before the first instance puts updated data back in. This is causing synchronization issues in my application.

Is there any way to "lock" the datastore s开发者_运维百科o that nothing can operate on it until the lock is released?

Thanks.


Transactions are what you're after.

Read the docs carefully though: there are strict limitations on what you can do within a transaction. Specifically, you can only query within a single entity group - that is, the set of entities with the same ancestor.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜