[CDO] Facing troubles when trying to use lock mechanism [message #1841453] |
Mon, 17 May 2021 13:25  |
Xavier GISTAU 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 cdoObject.cdoWriteLock().lock()/unlock
- a SessionListener that reacts to the CDOSessionLocksChangedEvent 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 transaction.options().setAutoReleaseLocksEnabled(false) 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 !
Xavier
|
|
|
|
Powered by
FUDForum. Page generated in 0.01873 seconds