Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] Resolving merge conflicts
[CDO] Resolving merge conflicts [message #1692869] Mon, 20 April 2015 10:32 Go to next message
Alexander Klatt is currently offline Alexander KlattFriend
Messages: 59
Registered: April 2014
Member
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 05:48 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
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 #1693164 is a reply to message #1692985] Wed, 22 April 2015 08:12 Go to previous messageGo to next message
Alexander Klatt is currently offline Alexander KlattFriend
Messages: 59
Registered: April 2014
Member
Quote:

Can you paste a link? Never trust the documentation. The code is clear: CDOMergingConflictResolver is *not* deprecated.


Well, only the juno release had an entry about this class (link). But you are right of course, the code does not state that it is deprecated.

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?
Re: [CDO] Resolving merge conflicts [message #1693166 is a reply to message #1693164] Wed, 22 April 2015 08:23 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
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


Previous Topic:[CDO] IAdaptable name clash
Next Topic:Invalidation Event (CSOSessionInvalidationEvent)
Goto Forum:
  


Current Time: Fri Apr 19 21:13:57 GMT 2024

Powered by FUDForum. Page generated in 0.03296 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top