Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] Facing troubles when trying to use lock mechanism
[CDO] Facing troubles when trying to use lock mechanism [message #1841453] Mon, 17 May 2021 13:25 Go to next message
Xavier GISTAU is currently offline Xavier GISTAUFriend
Messages: 6
Registered: February 2019
Junior Member
Hello everyone, I hope you are all doing well !

I have been using CDO for some months now and I am again coming here to ask you for some hints and help !

I am now trying to use the lock/unlock mechanism provided by CDO.

My architecture is the following :

- I have a CDO repo where my "shared model" is stored.
- I have two clients : Client A and Client B, that use a "locally stored" model synced with the shared one

I am trying to use the cdo.lock, so when a user is modifying an element of the model, the EObject gets locked until the modification is saved.

To achieve that I use:
- CDOTransaction to commit the changes, and also

- a SessionListener that reacts to the
that are happening in the CDORepo and reproduce the lock/unlock mechanism locally.

The problem I am facing is that when saving my changes(commiting it to the CDORepo), it seems that a CDOSessionLocksChangedEvent is thrown, even though my method using cdoObject.cdoWriteLock().unlock is not called yet. I have found that there is this option
that should stop these autorelease event. I have noticed that, indeed, when Client A is commiting its changes, Client B does not receive the autoRelease event.
But it seems like the SessionListener of Client A still receives this "autorelease lock event", from its own modifications and I don't know how to prevent that, because this "autorelease event" does not have any lockChangeInfo, in fact the lockChangeInfo is null.

So I am wondering, is there a way for a sessionListener to ignore the notification created by itself ? If not, then what should I use to implement the lock/unlock mechanism ?

Thank you for your time and help, have a great day !


Re: [CDO] Facing troubles when trying to use lock mechanism [message #1841524 is a reply to message #1841453] Thu, 20 May 2021 05:33 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6671
Registered: July 2009
Senior Member
You're right, the internal lockChangeInfo field should never be null. Via I've fixed one bug that could cause the null value. And I've also fixed another small bug that caused CDOSessionLocksChangedEvent with empty lockStates to be emitted locally. If you don't use CDO's sources please wait for tomorrow's I-build.

Previous Topic:Comment message for CDO
Next Topic:[CDO] Editing an existing model - do I need to again "prepare it for CDO" as per the docum
Goto Forum:

Current Time: Sat Jun 03 06:17:19 GMT 2023

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

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

Back to the top