Saturday, January 20, 2018

Locking mechanism : default, optimistic


There are two locking mechanisms supported by PRPC.

Default Locking and Optimistic locking.

Default Locking: 

If we have Parent case with three child cases in it, if we are performing on one of the assignments on one of child cases, lock would be acquired by that user. And it wouldn't allow any other user to perform any other assignment under the other child case or parent case, as the lock is acquired by user.

Lock string constucted would be the key of the parent, which would be same for all the assignments/cases. So no one else can acquire the lock on the same.

Optimistic Locking:

With default locking, we have a disadvantage that we are locking the whole parent case eventhough user is performing on one of the assignments of one child case.

So optimistic Locking came with an approach where lock is not acquired by the user, until user actually modifies something on the screen and submits the assingment.

Lets say user1 can open one assignmnet of child case, user 2 can also open the same assignment of child case. At this point, no body has the lock.

Among user1, user2 whomsoever submits the task first, he would acquire the lock and once done release it. Subsequent user trying to submit will get a notification saying that the case can be refereshed, as it got updated recently.





No comments:

Post a Comment


HowToPega : All rights reserved and the contents are copyrighted to Pavan Kumar Naidu