Thursday, September 19, 2024

What are the two types of locking in Pega in PRPC?

Types of locking in Pega

In Pega PRPC (Pega Rules Process Commander), the two primary types of locking in pega mechanisms used to manage concurrent access to cases and work items are.

There are two types of locking in Pega.

1. Default: Lock will be acquired when the case is opened.

2. Optimistic: Lock will be acquired only when action is taken on the case.

The type of locking can be chosen under the setting tab for case type. By default, Locking Multiple Operators cannot open the case simultaneously.

In optimistic locking, multiple operators can open a case in parallel. They cannot submit at the same time.

Types of locking in Pega
Types of locking in Pega

1. Default (Pessimistic) Locking:

  • Description: In default or pessimistic locking, a lock on the case or work item is acquired as soon as a user opens it for processing. This lock ensures that only one user can make changes at a time by preventing modifications from other users until it is released.
  • Use Case: This type of locking is ideal in scenarios where it is essential to maintain data integrity and consistency, especially when there is a high likelihood of conflicts arising from concurrent updates by multiple users.
  • Conflict Resolution: Since the case is locked as soon as it is opened, other users attempting to access the same case will receive a notification that the case is locked and cannot be modified until the lock is released. This approach simplifies conflict resolution as it inherently prevents concurrent modifications.

Key Features:

  • Immediate Lock Acquisition: As soon as a user opens a case, the system acquires a lock, preventing others from making changes.
  • Lock Duration: The lock remains in place until the user completes their task and submits the changes, or the lock times out.
  • Lock Management: Administrators can configure lock timeout settings to avoid locks being held indefinitely in case of user inactivity or system issues.

2.Optimistic Locking:

Description:

In optimistic locking, the system does not acquire a lock on the case or work item when a user opens it. Instead, the system applies the lock only when the user attempts to save changes to the case. This allows multiple users to open and view the same case simultaneously.

Use Case:

This type of locking benefits environments with infrequent conflicts and enhances system performance by reducing lock duration. It is suitable for scenarios where users are mostly reading data rather than updating it.

Conflict Resolution:

If two users try to save changes to the same case at the same time, the system will detect the conflict. The system notifies the second user attempting to save that another user has updated the case. They will need to reload the case and reapply their changes if necessary.

Key Features:

  • Deferred Lock Acquisition: Users can view and potentially edit cases without immediate locks, only locking at the point of data modification.
  • Conflict Detection: The system checks for conflicts when changes are saved. The system triggers a conflict resolution process if another user modifies the data.
  • Version Control: This often involves maintaining version numbers or timestamps to detect changes made by other users.
Work Object types of locking in Pega Locking Functional Algorithm:
  • When an operator tries to edit a case, PRPC verifies whether any other operator is currently editing the same case or not.
  • If yes, it displays a message saying that some other operator is editing it.
  • If no, it allows the current operator to edit the case.
Work Object Locking Technical:
  1. When an operator Try to edit a case; PRPC verifies if there is a record in the table “PR_SYS_LOCKS.”.
  2. This option conveys the core message: finding the record and its locked state due to another user’s edit.
  3. “If no record exists, PRPC adds a record in PR_SYS_LOCKS, granting the lock to the current user.”
Note:

Acquiring a lock means inserting a record into the PR_SYS_LOCKS table.

Releasing lock means deleting the record from the PR_SYS_LOCKS table.

When an operator opens a work object, PRPC acquires a lock-on case. At the same time, when others try to open the case, it displays the message’.  Operator1 is modifying the C case. This is default locking.

Conclusion

Both types of locking in Pega serve different purposes and are chosen accordingly. Based on the specific needs of the application and the nature of user interactions with cases and work items.

More topics  on pega click here

 

 

 

techvlogs
techvlogshttp://techvlogs.com
This Blog is dedicated to the Technology. We through this Website would cover the latest and trending Technologies in India and around the World. It is a dedicated Blogging Website which covers all the technical news across the Industries. We would also provide latest programming languages and updates in Global Market.

Most Popular

Related Articles

What is JavaScript Node.js Server-Side Example with Simple Code?

JavaScript, traditionally used for client-side web development, has gained significant traction in server-side js development through Node.js. Node.js is a runtime environment built on...

What is JavaScript Animation, css, Canvas API and WebGL?

JavaScript animation, CSS, Canvas API, and WebGL are pivotal tools in modern web development. These technologies are integral to creating dynamic, interactive, and...

What is TypeScript and flow in javaScript with example?

JavaScript is a versatile, dynamic language commonly utilized in web development. However, it lacks built-in type checking, which can lead to bugs and...