aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes isLocked method implementation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
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
Bartender

Joined: Sep 13, 2007
Posts: 2527
    
    8

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 OCPJP7 OCPWCD5 OCPBCD5
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11481
    
  94

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