This week's giveaways are in the MongoDB and Jobs Discussion forums.
We're giving away four copies of Mongo DB Applied Patterns and 4 resume reviews from Five Year Itch and have the authors/reps on-line!
See this thread and this one for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes isLocked method implementation Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Mongo DB Applied Patterns this week in the MongoDB forum
or a resume review from Five Year Itch in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Reply Bookmark "isLocked method implementation" Watch "isLocked method implementation" New topic
Author

isLocked method implementation

jesal dosa
Ranch Hand

Joined: Jun 25, 2007
Posts: 46
Hi All,

I am doing the final piece of the puzzle, the locking bit. I have been looking through some posts about the locking methodology, and i have come up with the following bit of code. What i dont understand is why do I need the isLocked method. When i am doing a booking i do the

lock
do the booking
unlock

i could use the isLocked method in the lock method to test the while condition. I have read a post which suggest the islocked in not required but rmandantory because its in the interface.



I just want to confirm the isLocked method is fine and not required apart from implementing suns interface
K. Tsang
Ranch Hand

Joined: Sep 13, 2007
Posts: 1219

Hi the isLock() method is required to implement cos it's part the interface. However, it's not necessary to use it. But it can be called inside your update/delete to ensure that record is locked before doing the actual update/delete.


K. Tsang JavaRanch SCJP5 SCJD/OCM-JD
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 10812
    
  24

Hi Jesal

Please take the time to read the JavaRanch SCJD FAQ, particularly the section on our policy on questions on the exam / details of how to do the assignment.

I agree with K Tsang that this method must be implemented, but need not be used. Slightly off topic - Ken Schwarber presented a talk on Scrum at Google, and towards the end of it (if I remember correctly) he talks about one of the typical problems with Waterfall, namely that because it becomes so difficult to introduce a change in the project 6 months after it is started, people tend to put into the requirements documents every possible thing they can think of, even if it has little value. In that respect, the instructions from Sun are very typical - they often contain instructions that have little or no value. And some of these are included deliberately just so that the developer has to make a design decision.

Regards, Andrew


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
jesal dosa
Ranch Hand

Joined: Jun 25, 2007
Posts: 46
Thanks K. Tsang and Andrew,

this clears it up. Sorry for the initial incorrect posting.

King Regards

Jesal
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: isLocked method implementation
 
Similar Threads
B&S: locking etc
Locking strategy
Record locking on recNo
NX: About data consistent
Locking