Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] Pessimistic lock with EMF Transaction
[CDO] Pessimistic lock with EMF Transaction [message #897835] Wed, 25 July 2012 09:31
Esteban Dugueperoux is currently offline Esteban DugueperouxFriend
Messages: 472
Registered: July 2009
Senior Member
Hi,

In our use case, where we manages ourself locks (with
CDOTransaction.options().setAutoReleaseLocksEnabled(false)), we use
pessimistic lock strategy using the EMF Transaction framework to avoid
conflict, we have cases where we can yet have conflict.

I explain first the architecture and the workflow.

We use a TransactionalEditingDomain and we have a
ResourceSetListenerImpl, we will call it Locker. On each CDOObject
change, through a EMF Command, the Locker check if one of the CDOObjects
is already locked by another user, if true the Locker throws a
RollbackException to undo the changes done during the EMF Command, if no
changed CDOObjects was already locked by another user then we allow the
changes and lock all changed CDOObjects and send a remote message
(CDORemoteSessionMessage) to indicate to all other users
(CDORemoteSession) the locked CDOObjects with a
RemoteMessageNotificationRequest.

After the user having done the changes save its changes, we commit and
just after we send a unlock message also through a
RemoteMessageNotificationRequest. Like that the other users update their
cache of locked objects by other, and are allowed to do changes.

The attached screenshot2.png show the normal workflow.

But the issue comes from the fact that RemoteMessageNotificationRequest
and CommitTransactionRequest are not sync, then remote users can
receives the unlock message before the InvalidationRunnable execution,
between the unlock message and the InvalidationRunnable execution,
remote users can do changes without being rollback by the Locker then we
come to a conflict.

The attached screenshot.png show the conflicting workflow.
This last image show that on user2 the invalidation
(InvalidationRunnable) is executed after the unlock message reception
then between these 2 events user2 have the permission to do model
changes like the CDOObjects are unlocked. But during the
InvalidationRunnable execution, some conflicts are detected and can't be
resolved then at the end user2 can't save its shared resource (CDOResource).

I don't know how to ensure that the InvalidationRunnable be done before
the unlock on the CDOServer and before the unlock message reception?

We have think about using the timestamp returned by the
CDOTransaction.commit()::CDOCommitInfo and send it with the unlock
message then when the user2 receives the unlock message it wait a
CDOViewAdaptersNotifiedEvent with the correct timestamp from the
InvalidationRunnable.

What do you think about this last solution?

Best Regards.
Previous Topic:[CDO] Pessimistic lock with EMF Transaction
Next Topic:[CDO] Pessimistic lock with EMF Transaction
Goto Forum:
  


Current Time: Sat Aug 24 18:13:18 GMT 2019

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

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

Back to the top