How to avoid a same work object which is returned on click of Getnextwork
In our project we have customized the GetNextwork to retrieve the workobjects(From PC_Assing_Workbasket) on click of a button, instead of default GNW we have used the store procedure. on click of a button a workobject is returned from store procedure to PRPC and simultaneously we move the work-object from workbasket to work list table(using set ticket), with this work object we will bind with the proper data and open an interaction.
Here iam facing a problem. assign-WB have lot of records, there is certain logic written in SP to retrieve the data. i should not allow to open the same workobject to the two different users. In real time there will be hundreds of users , when they click on button at the same moment it may return same record. Here im taking the lock once i get the work object, but while acquiring the lock it taking some time.
In my store procedure the main source is workbasket table.
Kindly suggest on this , how to avoid getting a same work object.
Doing pessimistic analysis here, let's say two users click the button simultaneously, so internally your procedure tries to give W-1 to both users. Somewhere in your procedure, both will attempt to lock W-1, and only one will succeed. The one that failed should quietly loop back and start over. That way, it will give W-2 to the other user. /Eric