in the Monkhouse DVD example (by the way it is such an orgnized and easy to follow book, thanks Monkhouse) we can find 2 levels of locking: 1. db layer, that's when we have to acquire a lock (could be read or read/write lock) before we do any operation depending on the operation. 2. inside the reservation manager, which provides logical locking.
now as a class we can't really reach to the database without going throw the facade, which gives us the ability to logically lock records before dealing with them.
so why would we still need the DB lower-level-locking (the frist one) if we are using the logical higher-level-locking anyway ?
SCBCD - SCWCD - SCJD - SCJP - OCA
posted 10 years ago
thread 1 is going to write at offset 8: RAF.seek(8);
then thread 2 jumps in: thread 2 is going to read at offset 5: RAF.seek(5); RAF.read();
and then thread 1 continues: RAF.write() -> but the offset is wrong [ August 29, 2007: Message edited by: John Stone ]