In the samples code, you'll see an example of a filter. http://code.google.com/p/google-app-engine-samples/source/browse/trunk/gwtguestbook-namespaces/src/com/google/gwt/sample/gwtguestbook/server/NamespaceFilter.java
The namespace is stored in thread local storage. It will work correctly for concurrent requests. However, only Java app engine currently allows concurrently running requests and only if it is switched on in the appengine-web.xml (or the app.yaml equivalent). see: http://code.google.com/appengine/docs/java/config/appconfig.html#Using_Concurrent_Requests On May 14, 1:43 am, mpire <[email protected]> wrote: > Hi! > > I'm trying to use the Namespace-API to build a multi-tenant app. > Therefore i have defined a filter that sets the Namespace for each request > regarding to the User making the request. > However, if there's a new Request before the current request finishes its > datastore-operation, the namespace would be overwritten by the new request > and the current operation would have an incorrect namespace. > I could also set the namespace before each datastore operation, but the > problem would be the same.If another request overwrites the namespace before > the operation is finished, the data in the database will be messed. > Is there a way to set the namespace for an entire request? Just use a namespace filter like the one in the example code (tailored to your use of course). > Or should i try to build some kind of Mutex around the NamespaceManager? No need. It will work out of the box. -- 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
