According to the specification, we only need to implement the flight booking, meaning that we need to apply a write lock to the modify method provided in the data class. As the specification does not mention that we need to implement the adding and deletion, I think we just leave the add and delete methods as they are. However, I understand that these two methods also require a write lock or else the database may be corrupted. Do we really to take care of the add and delete methods in terms of locking and unlocking?
Well, it's true that you will probably need lock and unlock for add and delete methods. But they are not needed for the assignment, at least not for my requirement. Besides, if you need to implement add, delete functionalities, you should add a method similar to booking, and let that emthod call the lock and unlock.
Joined: Dec 27, 2000
Adrian and Sam, If that is the case, you apply a collection API, say the hash table, only to the modify() method, but not the add() and delete() methods. The hash table is for keeping trach the lock and unlock state of the records. Is that true to you?
I see that the add/delete methods seems more like an administration tool as far as this application is concerened more than a real tool. However, I see that after adding/deleting a record, the record count is not increased or decreased by 1. It seems to be the one that is used at startup. A bit strange. In a future scenario, User A requests lock on DB, User B request lock on DB, User C requests lock on DB. Lets assume that the locks will be served in the order A, B,C . A and C seek to modify the database while B is going to remove the same very record. How is the database going to handle this scenario???
Never be satisfied with anything less than the best and you will surely pass the test...
I didn't touch add or delete. I think it was there for the older version of the assignment when you had to create a conversion program to put a text file of data into the db.db file. I did not lose any points for not touching it. Mark
Kalichar, Vow!! You replied my mail that was posted almost a year ago. Referring to the scenario you mention, I think it will never happen if your locking mechanism is in a synchronized block or method. In this way, only one client can be granted the lock and have the only access to the database or record locked at any time. Good luck, Rudy
Joined: Jan 15, 2002
I do understand that but what I am referring to is A gets lock does modification and unlocks, B gets lock does modification, releases lock, C gets lock modify??? The record it is searching for is gone, the record count is not updated...whats up....