I would like to hear Ikai or other Google folk weigh in on this point, as I find that caveat quite unsettling myself.I would like to hear why it is possible to get those exceptions and the transaction still succeed.
Broc On Dec 15, 2:24 am, coltsith <conla...@gmail.com> wrote: > Hi Broc, thanks for the reply. > > This sounds great to me. I'm concerned about one small note on this > page:http://code.google.com/appengine/docs/java/datastore/transactions.html > > "If your app receives an exception when submitting a transaction, it > does not always mean that the transaction failed. You can receive > DatastoreTimeoutException, ConcurrentModificationException, or > DatastoreFailureException exceptions in cases where transactions have > been committed and eventually will be applied successfully. Whenever > possible, make your datastore transactions idempotent so that if you > repeat a transaction, the end result will be the same." > > Doesn't that mean I can still get a ConcurrentModificationException > even if the write was/will be successful? And if so then that example > I outlined could still be possible? > > Thanks > > On Dec 14, 4:43 pm, Broc Seib <broc.s...@gmail.com> wrote: > > > > > > > > > I think you are mistaken about ConcurrentModificationException meaning > > it will eventually commit. > > > If you get a ConcurrentModificationException, then that means the > > entity *failed* to write (because another write has modified the > > update timestamp on that entity group). You must catch that exception > > and try to write again (unless you don't want to overwrite). > > > You can see this behavior first hand here:http://gaetestjig.appspot.com/ > > and click on the "Unique Constraint" tab. Click the "Advance Alice" > > button four times, and click the "Advance Bobby" button four times (in > > any order). Now click on either button a fifth time and it will write > > the entity to the data store, and clicking the other button will > > experience a ConcurrentModificationException. > > > Broc > > > On Dec 13, 5:48 pm, coltsith <conla...@gmail.com> wrote: > > > > I recently got a ConcurrentModificationException, and the > > > documentation states that this will be "committed and eventually will > > > be applied successfully." However I got to thinking of a possible > > > outcome: > > > > Request A modifies entity > > > Request B modifies entity and receives ConcurrentModificationException > > > D > > > Request E modifies entity > > > ConcurrentModificationException D commits and is applied, which > > > overwrites Request E's work. > > > > Can this happen? Or does Request E get its own > > > ConcurrentModificationException since (D) hasn't been committed yet? > > > > Many 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-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.