How is the distinction between a read lock and a write lock made in the
SCJD? The instructions do not make any mention of a scenario where multiple clients(threads) could have multiple read locks on it, and what will happen if there are multiple read locks on a record and another client tries to obtain a write lock to modify the record?
Should the writing client wait until all read locks are dequeued? Or should the app allow dirty reads (since we won't keep track of reading locks)?
I find this a bit problematic to resolve since the SCJD instructions do not say anything about this issue of read-write locks? It just says "Lock" the record - but there's a distinction between locking for reading and locking for writing, no?
Aside of this, lock and unlock are rather trivial, can be implemented using some sort of a list structure (I havent yet thought out what data struc to use so forgive me) that would keep track of which records are locked and synchronize on that list when acquiring the lock in a familiar while()/wait()/notify() combo....
Your input is very much appreciated.
Martin
p.s.
Alan Ford is not my real name, but then again I never enter my real name unless I absolutely _have_ to
.