posted 21 years ago
hey all,
Suppose i run my FBN client (client A) in local mode. It attaches to a local db.db and tries to make bookings. Suppose another FBN client, client B (running in a different JVM, but on the same computer) attaches to the same db.db file and starts making bookings. I see a conflict here:
1. Client A grabs a record and determines it can deduct a certain number of seats from the booking.
2. Client B grabs a record and determines it can deduct a certain number of seats from the booking.
3. Client B deducts the seats and writes the updated record back to db.db.
4. Client A deducts the seats and writes the updated record back to db.db.
This, of course will produce an incorrect number of seats on the database in that particular record (i hope you all see why).
My question is this:
I understand why we need locking records between clients in remote mode - to prevent the situation i just described. But how can this situation be prevented in the case FBN clients (or in a more general case - unrelated programs) attempt to modify database? How can locking be done in this case?