Maybe you can look into low level API to obtain a "lock" http://code.google.com/appengine/docs/java/javadoc/com/google/appengine/api/memcache/MemcacheService.html#increment%28java.lang.Object,%20long%29
There're also sample implementation using this posted in the group https://groups.google.com/group/google-appengine/browse_thread/thread/253b9f79f0c178d9/0188ee19a3460ec4?#0188ee19a3460ec4 On Fri, Apr 23, 2010 at 11:23 AM, Phuong Nguyen <phuongn...@gmail.com>wrote: > Hi guys: > I'm creating an app that I need to deal with concurrent modification of > object. > Given I have an object that I need to store on memcache. > Now, given my user base would be big enough for two request to arrive > simultaneously at two different servers in the cloud. > So, in order to modify the object, the server #1 that receive request fetch > the object from memcache (Correct me if I'm wrong: this will deserialized > raw data on memcache in to Java Object on Server #1 JVM), modify it and then > put it back to memcache (which in turn serialize the object). > At the same time, server #2 tried to modify the object on memcache. > > Under this scenario: Server #1 fetch object> Server #2 fetch object > > Server #1 store object > Server #2 store object > Then all changes make by Server #1 will be overrided by Server #2. > > If these 2 requests happen on the same Server (and in effect, the same > JVM), then I believe the use of synchronized access will help. But in case > they happen on different server, then I don't know how to handle them yet. > > Would you guys advice me on that? > Thanks. > > > -- > 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-j...@googlegroups.com. > To unsubscribe from this group, send email to > google-appengine-java+unsubscr...@googlegroups.com<google-appengine-java%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/google-appengine-java?hl=en. > > -- 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-j...@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.