I have implemented record locking in the following manner. My DataServer creates a new DataSession object for each client that connects to it. The DataServer passes a Data reference and a LockManager reference to the constructor of the DataSession object. So, when a client issues a lock or unlock command to the DataSession, the client�s DataSession object calls the lock method of the LockManager passing in the record number and a reference to the DataSession.
So, record locking is implemented in the dataServer portion rather then the Database portion of the assignment. In fact, the lock and unlock methods of the Data class are totally empty. I did this because I wanted to make sure that the only client that could unlock a locked record was the one that locked it in the first place. I am happy with this approach except for the following line the Instructions� Under
Record locking must be implemented using the methods public void lock(int) and public void unlock(int). These methods are required to allow concurrent use of the database when booking flights from multiple clients.
Has anybody else taken this approach and submitted the assignment? Did you loose points for deviating from the design specifications?