Hello all,
I'd like to discuss a little bit about my locking approach. Ok, as I said on the subject,
I've implemented on 2 levels:
1. Of course, the first level concerns about DB interface. Both lock/unlock methods are called by my business class, which use them before booking/unbooking/reading records. So, on Data class I'm locking records.
2. Inside Data (which implements DB), I use another class called FileManager to play with an RandomAccessFile instance, doing the "dirty job". So, my FileManager also has lock/unlock methods, and all the requests to the database are handled there. The point is, one
thread by time does something on the databasc. Clarifying: I'm locking the whole database file, no matter what is being done there.
When booking, I always check if the record was booked before (raising an exception in this case).
Does anybody see problems locking also the whole database file? What about lock/unlock being called by a business class only, and not the GUI, is this ok?
Thanks for reading.