http://code.google.com/p/datanucleus-appengine/issues/detail?id=134

On Fri, Sep 25, 2009 at 11:33 AM, Max Ross
<[email protected]<maxr%[email protected]>
> wrote:

> Short answer:
> Yes, the pattern is incorrect.
>
> Longer answer:
> This is a bug - we throw JDOCanRetryException when this failure occurs
> without a txn, but we throw the wrong exception when this failure happens
> during txn commit.
>
> Great catch!  I'll file a bug and update this thread with the link.
>
> Thanks,
> Max
>
>
> On Fri, Sep 25, 2009 at 1:09 AM, Patrizio Munzi 
> <[email protected]>wrote:
>
>>  Hi all,
>>
>> I'm trying to verify transactions behavior, and what I see is that
>> commit() method never throws a JDOCanRetryException as explained in doc when
>> the same entity group has being modified concurrently.
>> I always get a JDOException caused by ConcurrentModificationException.
>>
>> My question is:
>> Is this pattern incorrect??
>> -------------------------------------
>>
>>         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;
>>                 }
>>             }
>>         }
>> -------------------------
>>
>> should it be modified this way??
>>
>> -------------------------------------
>>
>>         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 (JDOException ex) {
>>                 if (!(ex.getCause() instanceof
>> ConcurrentModificationException ) || i == (NUM_RETRIES - 1) {
>>
>>                     throw ex;
>>                 }
>>             }
>>         }
>> -------------------------
>>
>> Please let me know
>>
>> 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 [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
-~----------~----~----~----~------~----~------~--~---

Reply via email to