Hi,

I got a rather simple question and I am sure there is a simple solution.

Let's say I got a RPC endpoint that checks if an entity exists and
then creates another entity. This RPC endpoint can be called
simultaneously on different instances. Say we got a user object, and
sometimes we generate an AccountStatus for the User. The generation is
triggered by an RPC call that checks if AccountStatus for an User
exists - if not it generates a new entity.

The problem is: While one RPC checks if an entity exists - the other
RPC call is already after the check (with no result) and generates the
AccountStatus entity. This results in two entities being created and
not one.

I guess what I want to have is some kind of check and lock. My
question is how to implement an "efficient" lock on a distributed
environment like GAE. Transactions? Or better using memcache?


Is there a best practise how to implement that?


Thanks :)

Best,


Raphael

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to