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 ]
SCJD<br />SCJP 1.4
Joined: May 12, 2004
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.
Joined: Dec 27, 2005
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.