jQuery in Action, 2nd edition*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Uncertain about requirements B&S Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Uncertain about requirements B&S" Watch "Uncertain about requirements B&S" New topic
Author

Uncertain about requirements B&S

Filip Moens
Greenhorn

Joined: Oct 16, 2003
Posts: 24
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)?
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11465
    
  94

Hi Filip,
You might be interested in reading the thread "Should lock methods be callable by the client" - that should either clear up your doubts about question 1, or confuse you further
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


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Filip Moens
Greenhorn

Joined: Oct 16, 2003
Posts: 24
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.
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11465
    
  94

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Uncertain about requirements B&S