• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Locking the record using the cookie

 
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am slightly confused, in terms of locking a record using a cookie. It also says only the owner of the cookie can unlock the record.

I am not sure how it is to be done.

Two questions.
1. Are we locking the records in the DB file.
2. If we are locking the record in the DB file, is the "marker" as the start of each record is to be used to store the cookie file.

Help would be much appreciated.

Regards
Aruneesh
 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't think record in the DB file itself is "locked".
The locking occurs in memory to allow a client exclusive access to view and update a record. This prevents another client from doing something to the record in between the first clients view and update. The cookie identifies which client owns the lock. The locks should not persist across server restarts.
[ January 27, 2006: Message edited by: B Chen ]
 
Aruneesh Salhotra
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This makes me assume that what you are saying is that there would be a array of vectors, containing information read from the DB file.

On any call, the rows are locked. I think the better design would be to locked the whole vector, and then proceeding.
 
B Chen
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You mean a vector of DB records?
If multiple threads (clients) can add/remove items from the vector (which is probably true for any of the assignments), yes then you should lock on the vector before proceeding. The thread-safety provided by the vector class is not sufficient.
reply
    Bookmark Topic Watch Topic
  • New Topic