Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question about lock/unlock design specs

 
Titus Campbell
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2937
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 4118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic