File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Question about lock/unlock design specs 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 "Question about lock/unlock design specs" Watch "Question about lock/unlock design specs" New topic

Question about lock/unlock design specs

Titus Campbell

Joined: Sep 17, 2002
Posts: 10
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�
Extending suncertify.db.Data

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?
John Smith
Ranch Hand

Joined: Oct 08, 2001
Posts: 2937

Has anybody else taken this approach and submitted the assignment?

Pretty much the approach that many of have taken and passed with good scores.
Max Habibi
town drunk
( and author)

Joined: Jun 27, 2002
Posts: 4118
Many people have also taken a more strick interpertation of the specs, and locked the record by implementing the Data.lock method. Both approaches seem to be accepted.
M, author
The Sun Certified Java Developer Exam with J2SE 1.4

Java Regular Expressions
I agree. Here's the link:
subject: Question about lock/unlock design specs
It's not a secret anymore!