[appengine-java] Re: Which datastore exceptions are appropriate for Re-try

2009-11-09 Thread Diana Cruise

Leszek, thanks much!

On Nov 9, 11:20 am, Diana Cruise  wrote:
> WSouza, what scenario triggers UnknownException?
>
> On Nov 9, 3:24 am, leszek  wrote:
>
>
>
> >http://code.google.com/intl/pl/appengine/docs/java/datastore/transact...
>
> > 
> >         for (int i = 0; i < NUM_RETRIES; i++) {
> >             pm.currentTransaction().begin();
>
> >             ClubMembers members = pm.getObjectById(ClubMembers.class,
> > "k12345");
> >             members.incrementCounterBy(1);
>
> >             try {
> >                 pm.currentTransaction().commit();
> >                 break;
>
> >             } catch (JDOCanRetryException ex) {
> >                 if (i == (NUM_RETRIES - 1)) {
> >                     throw ex;
> >                 }
> >             }
> >         }
> > - Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[appengine-java] Re: Which datastore exceptions are appropriate for Re-try

2009-11-09 Thread Diana Cruise

WSouza, what scenario triggers UnknownException?

On Nov 9, 3:24 am, leszek  wrote:
> http://code.google.com/intl/pl/appengine/docs/java/datastore/transact...
>
> 
>         for (int i = 0; i < NUM_RETRIES; i++) {
>             pm.currentTransaction().begin();
>
>             ClubMembers members = pm.getObjectById(ClubMembers.class,
> "k12345");
>             members.incrementCounterBy(1);
>
>             try {
>                 pm.currentTransaction().commit();
>                 break;
>
>             } catch (JDOCanRetryException ex) {
>                 if (i == (NUM_RETRIES - 1)) {
>                     throw ex;
>                 }
>             }
>         }
> 
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[appengine-java] Re: Which datastore exceptions are appropriate for Re-try

2009-11-09 Thread leszek

http://code.google.com/intl/pl/appengine/docs/java/datastore/transactions.html


for (int i = 0; i < NUM_RETRIES; i++) {
pm.currentTransaction().begin();

ClubMembers members = pm.getObjectById(ClubMembers.class,
"k12345");
members.incrementCounterBy(1);

try {
pm.currentTransaction().commit();
break;

} catch (JDOCanRetryException ex) {
if (i == (NUM_RETRIES - 1)) {
throw ex;
}
}
}

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[appengine-java] Re: Which datastore exceptions are appropriate for Re-try

2009-11-07 Thread WSouza

ApiProxy.UnknownException (sometimes)

On Nov 6, 5:22 pm, Diana Cruise  wrote:
> There are only 5 exceptions documented for the datastore at the link
> below:
>
> http://code.google.com/appengine/docs/java/javadoc/com/google/appengi...
>
> From the descriptions, it appears only 2 of 5 are conditions where a
> re-try may succeed.  They are:
>
> DatastoreFailureException
> DatastoreTimeoutException
>
> Can anyone confirm from their experience that these are the only
> appropriate to re-try a transaction?
>
> For example, when you hit the 30s timeout limit I assume the timeout
> exception above is triggered.  Or, what if your transaction fails due
> to another update in-progress on the same entity group...what
> exception gets thrown for that?  Clearly, you would want to re-try in
> that case!
>
> 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
-~--~~~~--~~--~--~---