Excellent; thanks. I also took out the "uber catch" I was thinking I needed; it was late at night and I was awash in catch blocks.
ted stockwell wrote: > > On Nov 17, 10:27 pm, Rusty Wright <[email protected]> wrote: >> Ah, thanks. So if I knew how many servers my cloud is made of then I should >> use that number for my MAX_RETRIES. ;-) >> >> I'm curious about how others are handling the exceptions. The >> JDOCanRetryException is subclassed by other exceptions that don't seem like >> things I'd want to retry, but perhaps I don't understand the subtleties. >> > > You are correct, you don't want to retry on any error, only the > 'retry' errors. > I would write the retry method something like this... > > > public Object retry(final ProceedingJoinPoint pjp) throws Throwable > { > this.log.debug("called"); > > int retryCount = 0; > > while (true) { > JDOException exception = null; > > try { > return (pjp.proceed()); > } > catch (final JDOCanRetryException ex) { > exception = ex; > // retry > } > catch (final JDOException ex) { > > /** > * to quote Google's documentation: If any action > * fails due to the requested entity group being in > * use by another process, JDO throws a > * JDODataStoreException or a JDOException, caused by > a > * java.util.ConcurrentModificationException. > */ > if (!(ex.getCause() instanceof > ConcurrentModificationException)) > throw ex; // fail > > exception = ex; > // retry > } > > this.log.debug("retryCount: {}, exception: {}", > Integer.valueOf(++retryCount), > ExceptionUtils.getFullStackTrace(exception)); > } > } > > -- > > 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=. > > -- 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=.
