• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Question about lock/unlock design specs

 
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?
 
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.
 
town drunk
( and author)
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
    Bookmark Topic Watch Topic
  • New Topic