Question
EPAM Systems
UA
Last activity: 16 Oct 2018 12:03 EDT
Remove the lock that belongs to another operator
Hi,
PRPC 7.2.2
Faced with a similar problem stated in the post:
https://pdn.pega.com/community/pega-product-support/question/how-force-remove-lock-belongs-another-operator#comment-556016
Problem with method remove in the class com.pega.pegarules.data.internal.access.LockCacheImpl
In the Last comment (from MaheshMidthuru):
public void remove(String key, String aTenantId);
key - key the name of the lock
aTenantId - the tenant id of the requestor, null if not a multi-tenant installation
Not clear for me description the aTenantId parameter.
How we can detect is this a multi-tenant installation or not?
And where we can see the tenant id of the requestor (if multi-tenant)?
Hi,
PRPC 7.2.2
Faced with a similar problem stated in the post:
https://pdn.pega.com/community/pega-product-support/question/how-force-remove-lock-belongs-another-operator#comment-556016
Problem with method remove in the class com.pega.pegarules.data.internal.access.LockCacheImpl
In the Last comment (from MaheshMidthuru):
public void remove(String key, String aTenantId);
key - key the name of the lock
aTenantId - the tenant id of the requestor, null if not a multi-tenant installation
Not clear for me description the aTenantId parameter.
How we can detect is this a multi-tenant installation or not?
And where we can see the tenant id of the requestor (if multi-tenant)?
(PRPC 7.2.2)
Thanks,
**Moderation Team has archived post**
This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.
-
Likes (2)
Siva Jyothi PamiReddy Radha Krishna kota -
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Pegasystems Inc.
US
Hello,
I can see pzTenantID property which is available in System-Requestor-Context(pr_sys_context) class which takes pzRequestorId as input key property. You can query this class and check the tenant id of your requestor.
Also you can look into pyIsMultiTenant when rule.
Regards
Mahesh
Pegasystems Inc.
US
Also you can identify whether the environment is a multi-tenant or not with below steps?
- At the database level most of the tables contain the column pzTenantId defined as VARCHAR2(255) NOT NULL. One can verify whether tables such PR4_RULE and PR_OPERATORS contain the above column or not?
- One can login as the multitenant administrator ([email protected]) and verify whether the Tenant Management landing page (Designer Studio > System > Tenant Management) exists or not?
Hope this helps you.
EPAM Systems
UA
Thank you, Mahesh
pyIsMultiTenant returns false.
And pr_sys_context table is empty.
It's mean that I can use null for that parameter.
Best regards,
Yuriy
Pegasystems Inc.
US
Yes Yuriy, you can go ahead with the null value for tenantid if that is the case.
EPAM Systems
UA
String LockHandle="***pxLockHandle***";//pxLockHandle for your work object
try{
PublicAPI tools = ((PRThread)ThreadContainer.get()).getPublicAPI();
ClipboardPage myPage=tools.createPage("Work-","myPage");
String stmt = "delete from {class:System-Locks} where pxlockhandle = '";
stmt +=LockHandle+ "'";
tools.getDatabase().executeRDB(stmt, myPage);
/*End of deleting the lock entry from DB table.*/
Class cls = tools.getDatabase().getClass();
Class noparams[] = {};
java.lang.reflect.Method method = cls.getDeclaredMethod("getLockCache", noparams);
method.setAccessible(true);
Object lockCache = method.invoke(tools.getDatabase() , null);
cls = lockCache.getClass();
Class[] args = {String.class,String.class};// type of parameters
method = cls.getMethod("remove", args);
Object[] argVals = {LockHandle,null}; //values of parameters
method.setAccessible(true);
method.invoke(lockCache, argVals);
} catch (Exception e) {
oLog.error(e);
}
but It not release the lock.
Have anybody comments or solution for resolve this problem?
Pegasystems Inc.
US
@Yuriy, have you tried with the OOTB System-Locks.ReleaseLock activity?
EPAM Systems
UA
@Mahesh, yes I have tried. ReleaseLock activity works good with locks for the same requestor only.
Pegasystems Inc.
US
I need to know why you are trying to release the lock of other requestor, so looking for below information:
- How long the lock has been held?
- As you are writing the code, is this a common operation / issue specific?
- Does the row in pr_sys_locks get deleted at least?
EPAM Systems
UA
Hi Mahesh,
1) in the application used standart settingth for Lock. For parent case Locking strategy "A case is opened (default)". For SubCases Locking strategy "Locking strategy is inherited from parent case type" and selected "Do not lock the parent case when the child case is opened";
When the subCase has Soft Lock all work good. But for true Lock not work.
2) This solution need to release the Lock for subCases when they are locked by another operators.
3) Yes. The row from the table pr_sys_locks has been deleted.
Updated: 3 Oct 2017 8:11 EDT
EPAM Systems
UA
Hi Mahesh,
Do you have ideas?
Pegasystems Inc.
US
Hi Yuri,
Even though the record has been deleted in the pr_sys_locks table, but there will be a memory cache on the node. So the lock has been not yet released in your case.
This needs to be investigated further by the Product engineers to confirm you the right approach to delete this record in the table and clear the memory in the node for the lock. So i suggest you to raise an SR with Global Customer Support team to investigate this issue further and provide the solution to your requirement if it is feasible.
Regards
Mahesh
Pegasystems Inc.
US
Also i can see the internal discussions regarding this requirement and the product team is not ready to provide any way to steal lock from another user without blowing up the second requestor. So i am not sure whether your requirement will be implemented.
Express script
US
Hi YURA4GOLOVKO,
Before deleting the record from the pr_sys_locks get the PXYSTEMNODE value and convert to Upper case and pass that value as argument and verify..
Object[] argVals = {LockHandle,PXYSTEMNODE};