I'm having doubts about what some requirements exactly mean. Anyone out there to share your thoughts? Sun provided the interface "DB.java" and states that: "Your data access class must be called "Data.java", must be in a package called "suncertify.db", and must implement the DB interface". The locking part in the assignment states: "Your server must be capable of handling multiple concurrent requests, and as part of this capability, must provide locking functionality as specified in the interface provided above. You may assume that at any moment, at most one program is accessing the database file; therefore your locking system only needs to be concerned with multiple concurrent clients of your server. Any attempt to lock a resource that is already locked should cause the current thread to give up the CPU, consuming no CPU cycles until the desired resource becomes available." 1. Does this mean that all methods from the DB interface MUST be available to a remote client? This to allow the marker to lock a record remotely, get a coffee and unlock it after returning? Currently, all my locking and unlocking is triggered on the server only, and no lock/unlock methods are available to the client code. 2. I think you can avoid throwing a RecordLockedException back to the client by carefully synchronizing methods on the server. Am I right? If so, should I nevertheless foresee the possibility in the client that a record can be locked (this in case the marker follows the aforementioned lock-coffee-unlock sequence)?
I think you can avoid throwing a RecordLockedException back to the client by carefully synchronizing methods on the server. Am I right?
Is RecordLockedException mentioned in the interface provided by Sun? If so, in which methd? The lock() method certainly shouldn't throw this exception, and I can't see any need for any other methods to throw this exception. Regards, Andrew
Andrew, RecordLockedException is not specified in any of the methods. I had already found the thread you mentioned and I have been looking at it for quite a while now. Very interesting, but... well, you know what I mean. I wonder how the markers proceed in testing the assignment. Regarding my previous question 1, I wonder if they would take my remote Data Access class and use it directly in code of their own to see if lock/unlock/update/delete etc. works as it should be. In that case, if it's not provided in my classes, I might fail miserably. Do you have an idea if they take it this far? I don't think they do.
author and jackaroo
Hi Filip, I don't think they go that far. There are quite a few people who have passed the exam who have had hidden the locking from the client (just had a book() method) and passed. So this does not appear to be something that will cause you to fail. Regards, Andrew