[CDO] Resolving merge conflicts [message #1692869] |
Mon, 20 April 2015 06:32  |
Eclipse User |
|
|
|
Hi,
I would like to commit changes to the same object A.
One thread changes A.x
and the other changes A.y
Even though, that these changes do not overlap, I get a commit exception. This is the expected behavior, right?
Until now, I had the strategy to rollback my transaction, reapply the changes and recommit in case of a conflict.
This does not seem very nice to me and after some research I found the following
code which seems to work for me:
transaction.options().addConflictResolver(new CDOMergingConflictResolver());
The documentation is not very clear on this topic, and the eclipse help says that
CDOMergingConflictResolver is deprecated.
Could you give me some advice on how I should handle merge conflicts?
Thanks!
|
|
|
Re: [CDO] Resolving merge conflicts [message #1692985 is a reply to message #1692869] |
Tue, 21 April 2015 01:48   |
Eclipse User |
|
|
|
Am 20.04.2015 um 12:32 schrieb Alexander Klatt:
> Hi,
>
> I would like to commit changes to the same object A.
>
> One thread changes A.x
> and the other changes A.y
>
> Even though, that these changes do not overlap,
They do overlap because they change the same object A.
> I get a commit exception. This is the expected behavior, right?
Yes.
> Until now, I had the strategy to rollback my transaction, reapply the changes and recommit in case of a conflict.
That is a valid strategy to resolve conflicts.
> This does not seem very nice to me and after some research I found the following
> code which seems to work for me:
>
> transaction.options().addConflictResolver(new CDOMergingConflictResolver());
Yes, that should work.
> The documentation is not very clear on this topic, and the eclipse help says that
> CDOMergingConflictResolver is deprecated.
Can you paste a link? Never trust the documentation. The code is clear: CDOMergingConflictResolver is *not* deprecated.
> Could you give me some advice on how I should handle merge conflicts?
I'll soon start to implement a completely new mechanism to resolving conflicts, but for now CDOMergingConflictResolveris
the right approach.
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
|
Re: [CDO] Resolving merge conflicts [message #1693166 is a reply to message #1693164] |
Wed, 22 April 2015 04:23  |
Eclipse User |
|
|
|
Am 22.04.2015 um 10:12 schrieb Alexander Klatt:
> Quote:
>> I'll soon start to implement a completely new mechanism to resolving conflicts, but for now
>> CDOMergingConflictResolveris the right approach.
> Thanks, so far! Just to clear up the usage of the conflict resolver:
> if I use the CDOMergingConflictResolver and change the same value from two threads, the latest commit will always set
> the value, right? Not depending on if the first commit actually changed the value at a later time but committed earlier?
No, that depends entirely on the CDOMerger that's used by the conflict resolver. The default resolver constructor
creates a DefaultCDOMerger.PerFeature.ManyValued merger, which merges on a per feature base, and which fails if both
sides changed the same feature (unless it's a many-valued feature).
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
Powered by
FUDForum. Page generated in 0.12252 seconds