Appengine devs have said on a number of occasions that we should not assume thread-safety of any class not documented as being thread-safe. I don't see anything in the javadocs indicating that DatastoreService is thread-safe, therefore keeping an appwide instance of DS is probably risky - even if it works today.
I'd suggest opening a fresh DatastoreService very time you need one. Jeff On Thu, Apr 1, 2010 at 7:07 PM, John Patterson <jdpatter...@gmail.com> wrote: > As Ikai pointed out a DatastoreService is really very light weight so it > really makes very little difference. > > If you are changing the config properties from place to place your only > options are to cache each service by config or create a new one each time. > If I were writing code by hand I would choose the simple option of creating > one as needed with the options you want at the time. > > On 2 Apr 2010, at 08:09, keyurva wrote: > >> In my application, I create a DatastoreService instance, maintain a >> reference to it and use it for the life of that instance of the >> application. >> >> In another discussion I learned that the cost of creating a new >> DatastoreService instance is negligible. >> >> Given that, is it still advisable for me to maintain a copy of the >> DatastoreService instance or should I create one anew every time I >> need to go to the datastore? >> >> Thanks, >> Keyur >> >> -- >> 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. >> > > -- > 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. > > -- 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.