• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Locking can't be that simple

 
uzma ali
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Below is my locking method and I don't know if that can be too simple I don't believe that.
My startegy is get to the recNo and read it and if the contractor Id is not null then wait otherwise.....and I do not what otherwise supposed to do because for update and delete there are separate methods.

My second questions the method supposed to return long and what exactly this long 'll be, I mean a recNo or something else.

Please help and is highly appreciated
 
Mark Ebeling
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Uzma,
I think you are confusing the Owner ID and the lockcookie into one issue, when in fact they are 2 seperate functions. The Owner ID is a user defined number that will be assigned during a Book action. All you will need to do is write this number to a file record. Once booked, there is (at least in my requirements) no need to unbook.
The lockcookie is used to lock database records before update/deletes can be performed. So the sequence should be lock - update - unlock. In order to obtain the lock, the record must be unlocked ( and in my assumptions - not deleted).
I return the lockcookie ( long ) creating a random number as follows:

Then when the update or unlock is called, the passed in lockcookie must match the one I have stored in memory for that record.

Hope that helps.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic