• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Locking can't be that simple

 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
The knights of nee want a shrubbery. And a tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic