aspose file tools*
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
Author

Question about lock/unlock design specs

Titus Campbell
Greenhorn

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�
Under
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.
Eugene.
Max Habibi
town drunk
( and author)
Sheriff

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
 
Don't get me started about those stupid light bulbs.
 
subject: Question about lock/unlock design specs