Question
AMEX
US
Last activity: 2 Mar 2016 19:53 EST
Pega 7.1.8 - Operator Locking
Hi Team,
As per my requirement, I have to update operator records based on a service call to Pega.
But this functionality fails when the service is called concurrently. This is because the locking is not implemented for Operator records.
Please let me know How can I implement locking.
I can use Allow Locking checkbox in Data-Admin-Operator-ID class.. But it doesn't allow me to save it as PegaRULES is a locked ruleset.
Thanks,
Sumanth
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Accepted Solution
Pegasystems
US
How about using a work object as a gatekeeper. That is, you lock the work object and then modify the operator record. Since only one of you can lock the work object, locking it acts as a gatekeeper. /Eric
Pegasystems Inc.
IN
Hi sumanth,
This seems to be a valid requirement .
Designer Studio Can you please provide your comments ?
Regards,
Haritha.D
Pegasystems Inc.
IN
Even I also faced the same issue. The error says "The class Data-Admin-Operator-ID is not configured to support locking "
May be we need to take it as an enhancement request ! But will wait for others comment on it.
Accepted Solution
Pegasystems
US
How about using a work object as a gatekeeper. That is, you lock the work object and then modify the operator record. Since only one of you can lock the work object, locking it acts as a gatekeeper. /Eric
AMEX
US
Thanks to all for the response.
Eric,
As per your response, you want me to create a workobject which never gets resolved and for each service request I need to attain a lock on it, modify operator and release the work object on Commit.?
Pegasystems
US
You’d only need one work object total, and you’d not need to even commit (unless you have other data that needs commiting). You could use the obj-open or obj-open-by-handle activity method steps with the “lock” checkbox, and then when you want to release the lock, you can use the page-unlock activity method.
That one work object could be created ahead of time and continually re-used as your gatekeeper. It doesn’t even matter whether it is resolved or not. /Eric
AMEX
US
Thank you for the response. But this somehow doesn't seem to be working.
Even though I lock the work object and releasing it on commit, multiple requestors are accessing the work object. Please see the log below:
XXXXXXXXXXXXXXXXXXXXXXXXXXXXX|Rest|api|v1|cases|A245AA4D8A9407C43553EFA09AE58A862 - Requestor A245AA4D8A9407C43553EFA09AE58A862 is attempting to lock "AEXP-LOGANMES-WORK M-00000000000234"
2016-02-29 09:31:18,944 [X.XX.XXX.XXX:XXXX-XX] [ STANDARD] [ ] [ PegaRULES:07.10] ( LockProvider) DEBUG XXXXXXXXXXXXXXXXXXXXXXXXXXXXX|Rest|api|v1|cases|A65CBFD89740AF100BB18E0237D44A85D - Trying to get lock provider from cluster
2016-02-29 09:31:18,944 [ Proprietary information hidden:8080-18] [ STANDARD] [ ] [ PegaRULES:07.10] ( LockProvider) DEBUG XXXXXXXXXXXXXXXXXXXXXXXXXXXXX|Rest|api|v1|cases|A245AA4D8A9407C43553EFA09AE58A862 - Trying to get lock provider from cluster
2016-02-29 09:31:18,944 [X.XX.XXX.XXX:XXXX-XX] [ STANDARD] [ ] [ PegaRULES:07.10] ( LockProvider) DEBUG XXXXXXXXXXXXXXXXXXXXXXXXXXXXX|Rest|api|v1|cases|A65CBFD89740AF100BB18E0237D44A85D - Retrived lock provider from cluster
2016-02-29 09:31:18,944 [X.XX.XXX.XXX:XXXX-XX] [ STANDARD] [ ] [ PegaRULES:07.10] ( LockProvider) DEBUG XXXXXXXXXXXXXXXXXXXXXXXXXXXXX|Rest|api|v1|cases|A65CBFD89740AF100BB18E0237D44A85D - Returning lock provider
Thank you for the response. But this somehow doesn't seem to be working.
Even though I lock the work object and releasing it on commit, multiple requestors are accessing the work object. Please see the log below:
XXXXXXXXXXXXXXXXXXXXXXXXXXXXX|Rest|api|v1|cases|A245AA4D8A9407C43553EFA09AE58A862 - Requestor A245AA4D8A9407C43553EFA09AE58A862 is attempting to lock "AEXP-LOGANMES-WORK M-00000000000234"
2016-02-29 09:31:18,944 [X.XX.XXX.XXX:XXXX-XX] [ STANDARD] [ ] [ PegaRULES:07.10] ( LockProvider) DEBUG XXXXXXXXXXXXXXXXXXXXXXXXXXXXX|Rest|api|v1|cases|A65CBFD89740AF100BB18E0237D44A85D - Trying to get lock provider from cluster
2016-02-29 09:31:18,944 [ Proprietary information hidden:8080-18] [ STANDARD] [ ] [ PegaRULES:07.10] ( LockProvider) DEBUG XXXXXXXXXXXXXXXXXXXXXXXXXXXXX|Rest|api|v1|cases|A245AA4D8A9407C43553EFA09AE58A862 - Trying to get lock provider from cluster
2016-02-29 09:31:18,944 [X.XX.XXX.XXX:XXXX-XX] [ STANDARD] [ ] [ PegaRULES:07.10] ( LockProvider) DEBUG XXXXXXXXXXXXXXXXXXXXXXXXXXXXX|Rest|api|v1|cases|A65CBFD89740AF100BB18E0237D44A85D - Retrived lock provider from cluster
2016-02-29 09:31:18,944 [X.XX.XXX.XXX:XXXX-XX] [ STANDARD] [ ] [ PegaRULES:07.10] ( LockProvider) DEBUG XXXXXXXXXXXXXXXXXXXXXXXXXXXXX|Rest|api|v1|cases|A65CBFD89740AF100BB18E0237D44A85D - Returning lock provider
2016-02-29 09:31:18,944 [X.XX.XXX.XXX:XXXX-XX] [ STANDARD] [ ] [ PegaRULES:07.10] ( LockProvider) DEBUG XXXXXXXXXXXXXXXXXXXXXXXXXXXXX|Rest|api|v1|cases|A65CBFD89740AF100BB18E0237D44A85D - Returned lock provider
2016-02-29 09:31:18,944 [X.XX.XXX.XXX:XXXX-XX] [ STANDARD] [ ] [ PegaRULES:07.10] ( LockProvider) DEBUG XXXXXXXXXXXXXXXXXXXXXXXXXXXXX|Rest|api|v1|cases|A65CBFD89740AF100BB18E0237D44A85D - Trying to get lock provider from cluster
2016-02-29 09:31:18,944 [ Proprietary information hidden:8080-18] [ STANDARD] [ ] [ PegaRULES:07.10] ( LockProvider) DEBUG XXXXXXXXXXXXXXXXXXXXXXXXXXXXX|Rest|api|v1|cases|A245AA4D8A9407C43553EFA09AE58A862 - Retrived lock provider from cluster
2016-02-29 09:31:18,944 [ Proprietary information hidden:8080-18] [ STANDARD] [ ] [ PegaRULES:07.10] ( LockProvider) DEBUG XXXXXXXXXXXXXXXXXXXXXXXXXXXXX|Rest|api|v1|cases|A245AA4D8A9407C43553EFA09AE58A862 - Returning lock provider
2016-02-29 09:31:18,944 [ Proprietary information hidden:8080-18] [ STANDARD] [ ] [ PegaRULES:07.10] ( LockProvider) DEBUG XXXXXXXXXXXXXXXXXXXXXXXXXXXXX|Rest|api|v1|cases|A245AA4D8A9407C43553EFA09AE58A862 - Returned lock provider
2016-02-29 09:31:18,944 [ Proprietary information hidden:8080-18] [ STANDARD] [ ] [ PegaRULES:07.10] ( LockProvider) DEBUG XXXXXXXXXXXXXXXXXXXXXXXXXXXXX|Rest|api|v1|cases|A245AA4D8A9407C43553EFA09AE58A862 - Trying to get lock provider from cluster
2016-02-29 09:31:18,945 [X.XX.XXX.XXX:XXXX-XX] [ STANDARD] [ ] [ PegaRULES:07.10] ( LockProvider) DEBUG XXXXXXXXXXXXXXXXXXXXXXXXXXXXX|Rest|api|v1|cases|A65CBFD89740AF100BB18E0237D44A85D - Retrived lock provider from cluster
2016-02-29 09:31:18,945 [ Proprietary information hidden:8080-18] [ STANDARD] [ ] [ PegaRULES:07.10] ( LockProvider) DEBUG XXXXXXXXXXXXXXXXXXXXXXXXXXXXX|Rest|api|v1|cases|A245AA4D8A9407C43553EFA09AE58A862 - Retrived lock provider from cluster
2016-02-29 09:31:18,945 [ Proprietary information hidden:8080-21] [ STANDARD] [ ] [ PegaRULES:07.10] (nternal.access.LockManagerImpl) DEBUG XXXXXXXXXXXXXXXXXXXXXXXXXXXXX|Rest|api|v1|cases|AA1A1A76BF33248F83D5639539C701550 - Requestor AA1A1A76BF33248F83D5639539C701550 is attempting to lock "AEXP-LOGANMES-WORK M-00000000000234"
2016-02-29 09:31:18,945 [ Proprietary information hidden:8080-21] [ STANDARD] [ ] [ PegaRULES:07.10] ( LockProvider) DEBUG XXXXXXXXXXXXXXXXXXXXXXXXXXXXX|Rest|api|v1|cases|AA1A1A76BF33248F83D5639539C701550 - Trying to get lock provider from cluster
2016-02-29 09:31:18,945 [X.XX.XXX.XXX:XXXX-XX] [ STANDARD] [ ] [ PegaRULES:07.10] (rnal.access.DBLockProviderImpl) DEBUG XXXXXXXXXXXXXXXXXXXXXXXXXXXXX|Rest|api|v1|cases|A65CBFD89740AF100BB18E0237D44A85D - Requestor A65CBFD89740AF100BB18E0237D44A85D running following SQL to add lock "AEXP-LOGANMES-WORK M-00000000000234": insert into LOGNDATA.pr_sys_locks ( pxCreateDateTime, pxCreateOpName, pxCreateOperator, pxCreateSystemID, pxExpireDateTime, pxLockHandle, pxObjClass, pxOwnerId, pxSystemName, pxSystemNode, pxUpdateDateTime, pxUpdateOpName, pxUpdateOperator, pxUpdateSystemID, pxUserHost, pyLabel, pzInsKey) values (?, ?, ?, ?, ?, ?, 'System-Locks', ?, ?, ?, ?, ?, ?, ?, ?, '', ?)
2016-02-29 09:31:18,945 [ Proprietary information hidden:8080-21] [ STANDARD] [ ] [ PegaRULES:07.10] ( LockProvider) DEBUG XXXXXXXXXXXXXXXXXXXXXXXXXXXXX|Rest|api|v1|cases|AA1A1A76BF33248F83D5639539C701550 - Retrived lock provider from cluster
2016-02-29 09:31:18,945 [ Proprietary information hidden:8080-21] [ STANDARD] [ ] [ PegaRULES:07.10] ( LockProvider) DEBUG XXXXXXXXXXXXXXXXXXXXXXXXXXXXX|Rest|api|v1|cases|AA1A1A76BF33248F83D5639539C701550 - Returning lock provider
2016-02-29 09:31:18,945 [ Proprietary information hidden:8080-21] [ STANDARD] [ ] [ PegaRULES:07.10] ( LockProvider) DEBUG XXXXXXXXXXXXXXXXXXXXXXXXXXXXX|Rest|api|v1|cases|AA1A1A76BF33248F83D5639539C701550 - Returned lock provider
2016-02-29 09:31:18,945 [ Proprietary information hidden:8080-21] [ STANDARD] [ ] [ PegaRULES:07.10] ( LockProvider) DEBUG XXXXXXXXXXXXXXXXXXXXXXXXXXXXX|Rest|api|v1|cases|AA1A1A76BF33248F83D5639539C701550 - Trying to get lock provider from cluster
2016-02-29 09:31:18,945 [ Proprietary information hidden:8080-18] [ STANDARD] [ ] [ PegaRULES:07.10] (rnal.access.DBLockProviderImpl) DEBUG XXXXXXXXXXXXXXXXXXXXXXXXXXXXX|Rest|api|v1|cases|A245AA4D8A9407C43553EFA09AE58A862 - Requestor A245AA4D8A9407C43553EFA09AE58A862 running following SQL to add lock "AEXP-LOGANMES-WORK M-00000000000234": insert into LOGNDATA.pr_sys_locks ( pxCreateDateTime, pxCreateOpName, pxCreateOperator, pxCreateSystemID, pxExpireDateTime, pxLockHandle, pxObjClass, pxOwnerId, pxSystemName, pxSystemNode, pxUpdateDateTime, pxUpdateOpName, pxUpdateOperator, pxUpdateSystemID, pxUserHost, pyLabel, pzInsKey) values (?, ?, ?, ?, ?, ?, 'System-Locks', ?, ?, ?, ?, ?, ?, ?, ?, '', ?)
2016-02-29 09:31:18,945 [1 Proprietary information hidden:8080-5] [ STANDARD] [ ] [ PegaRULES:07.10] (nternal.access.LockManagerImpl) DEBUG XXXXXXXXXXXXXXXXXXXXXXXXXXXXX|Rest|api|v1|cases|A9527D7E46D12ABFEA21203C0C19C1F9F - Requestor A9527D7E46D12ABFEA21203C0C19C1F9F is attempting to lock "AEXP-LOGANMES-WORK M-00000000000234"
2016-02-29 09:31:18,945 [ Proprietary information hidden:8080-21] [ STANDARD] [ ] [ PegaRULES:07.10] ( LockProvider) DEBUG XXXXXXXXXXXXXXXXXXXXXXXXXXXXX|Rest|api|v1|cases|AA1A1A76BF33248F83D5639539C701550 - Retrived lock provider from cluster
2016-02-29 09:31:18,945 [1 Proprietary information hidden:8080-5] [ STANDARD] [ ] [ PegaRULES:07.10] ( LockProvider) DEBUG XXXXXXXXXXXXXXXXXXXXXXXXXXXXX|Rest|api|v1|cases|A9527D7E46D12ABFEA21203C0C19C1F9F - Trying to get lock provider from cluster
2016-02-29 09:31:18,946 [1 Proprietary information hidden:8080-5] [ STANDARD] [ ] [ PegaRULES:07.10] ( LockProvider) DEBUG XXXXXXXXXXXXXXXXXXXXXXXXXXXXX|Rest|api|v1|cases|A9527D7E46D12ABFEA21203C0C19C1F9F - Retrived lock provider from cluster
2016-02-29 09:31:18,946 [1 Proprietary information hidden:8080-5] [ STANDARD] [ ] [ PegaRULES:07.10] ( LockProvider) DEBUG XXXXXXXXXXXXXXXXXXXXXXXXXXXXX|Rest|api|v1|cases|A9527D7E46D12ABFEA21203C0C19C1F9F - Returning lock provider
2016-02-29 09:31:18,946 [1 Proprietary information hidden:8080-5] [ STANDARD] [ ] [ PegaRULES:07.10] ( LockProvider) DEBUG XXXXXXXXXXXXXXXXXXXXXXXXXXXXX|Rest|api|v1|cases|A9527D7E46D12ABFEA21203C0C19C1F9F - Returned lock provider
2016-02-29 09:31:18,946 [1 Proprietary information hidden:8080-5] [ STANDARD] [ ] [ PegaRULES:07.10] ( LockProvider) DEBUG XXXXXXXXXXXXXXXXXXXXXXXXXXXXX|Rest|api|v1|cases|A9527D7E46D12ABFEA21203C0C19C1F9F - Trying to get lock provider from cluster
2016-02-29 09:31:18,946 [ Proprietary information hidden:8080-21] [ STANDARD] [ ] [ PegaRULES:07.10] (rnal.access.DBLockProviderImpl) DEBUG XXXXXXXXXXXXXXXXXXXXXXXXXXXXX|Rest|api|v1|cases|AA1A1A76BF33248F83D5639539C701550 - Requestor AA1A1A76BF33248F83D5639539C701550 running following SQL to add lock "AEXP-LOGANMES-WORK M-00000000000234": insert into LOGNDATA.pr_sys_locks ( pxCreateDateTime, pxCreateOpName, pxCreateOperator, pxCreateSystemID, pxExpireDateTime, pxLockHandle, pxObjClass, pxOwnerId, pxSystemName, pxSystemNode, pxUpdateDateTime, pxUpdateOpName, pxUpdateOperator, pxUpdateSystemID, pxUserHost, pyLabel, pzInsKey) values (?, ?, ?, ?, ?, ?, 'System-Locks', ?, ?, ?, ?, ?, ?, ?, ?, '', ?)
Pegasystems
US
What code are you using for locking the work ?
Also, remember that locks are requestor-wide, so other threads in your requestor will be allowed to access the work.
/Eric
AMEX
US
I am using obj-Open-by-handle.
ok the problem here is that when lock is not obtained by requestor, it is trying for some time and then if it is not able to obtain the lock, the step status fails and the execution proceeds to the next step.
So what I am currently doing is a recall of the same activity when the step status fails. But I am not sure how robust is the design.
Is there any possibility to create a custom class for Operators and map it to pr_operators table with locking enabled?
Pegasystems
US
Even if you had a class with locking enabled, you'd still need to solve your problem of how to detect when the lock fails to be obtained. Try using a post-condition on the activity step that checks "StepStatusFail" and branches appropriately if it's true. /Eric
AMEX
US
Thanks Eric..
That is the current implementation in place.. And seems to be working fine.
But with this approach, FIFO functionality is failing. As I recall the activity on step status fail to obtain lock, in the mean while if an other requestor comes in and tries to obtain lock, lock is handed over to the new requestor and hence FIFO fails
AMEX
US
Also.. is it possible to increase the lock retry interval?
Pegasystems
US
Right, FIFO is not supplied by the Pega locking facility. It merely gives you the lock if it's available and denies it if someone else has it. It's like a token. One requestor can have it.
Note that even if you were able to make a new class that allowed locking, the same lack of FIFO would prevail there as well.
To implement FIFO, how about having your listener take each service call and queue up an item for an agent. In each item, store info about which operator record to modify, and what field of the operator record should be modified, and what value it should be set to. The order of items in the queue would provide your FIFO, and since the agent would be the only one taking items out of the queue, there would be no locking issue.
/Eric