aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes The Mysterious 44/80 Locking score. 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 "The Mysterious 44/80 Locking score." Watch "The Mysterious 44/80 Locking score." New topic
Author

The Mysterious 44/80 Locking score.

Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

Here is an anonymous unofficial answer I have received at JavaOne, by someone really really close to the certification and knows about grading.

Basically if you get 44/80 means that the locking does not work in all cases. That there is a scenario that the examiners have run that shows the locking schema that you use does not fully lock in all concurrent scenarios.

Hope that helps.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Jason Hocker
Ranch Hand

Joined: Jul 23, 2003
Posts: 132
What scenarios can we think of that we should be testing so we do not fall victim to the 44/80?
Philippe Maquet
Bartender

Joined: Jun 02, 2003
Posts: 1872
Of course it helps! Thank you, Mark!

Phil.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

I'd say a scenario with multiple users and multiple machines all trying to get at a record at the same time.

And my favorite solution. KEEP IT SIMPLE!!!

Mark
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11460
    
  94

Thankyou Mark,

That is very good to know.

Regards, Andrew


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

Joined: Dec 03, 2003
Posts: 286
Hi,

Mark Spritzler wrote:

I'd say a scenario with multiple users and multiple machines all trying to get at a record at the same time.


I'm writing because I don't understand the implications behind the above remark, a remark
which others appreciate (because they see the implications immediately).

In my design and implementation, for every client there exists one data object on the server.

The following scenario works fine for me:
One computer, one application, multiple threads each representing a user, accessing
the database through the local or remote server.

I don't immediately see how the situation changes when you assume multiple machines.

Thanks,
Javini Javono
Javini Javono
Ranch Hand

Joined: Dec 03, 2003
Posts: 286
Hi,

In the month of July so far, two people received a score of 80/80 in locking:
Adrian Popescu and Maria Lepschy.

Did you all take any special action to ensure that a thread did not starve
waiting for a record lock? Or did you simply call notify() or notifyAll()
(which one?) and let the system determine which thread would be chosen
randomly next?

Thanks,
Javini Javono
paul_ov
Greenhorn

Joined: Feb 14, 2005
Posts: 1
Hello,

I'm wondering if the score will be deducted if one doesn't throw the RecordNotFoundException for the lock/unlock/islocked functions. Maybe people just check their locked records list and don't check in the database if the record actually exists.

Anyone ideas on this?

Paul


POV
Davinder Kohli
Greenhorn

Joined: Dec 25, 2004
Posts: 17
Originally posted by paul_ov:
Hello,

I'm wondering if the score will be deducted if one doesn't throw the RecordNotFoundException for the lock/unlock/islocked functions. Maybe people just check their locked records list and don't check in the database if the record actually exists.

Anyone ideas on this?

Paul


I was infact struggling with this today myself, whether to throw an exception when the recno does not exist in the database. Specially in the case of a isLocked(), why check if the recNo actually exists in the db. Simple return false if the recNo is not on the locked records list.

Anyway, I have implemented, the extra step to throw RNFException if the recNo does not exist in the db.

For the 44/80 score, I am guessing most of them have implemented the locking correctly for updates, deletes, but when it comes to reading, maybe they sneaked in dirty reads.
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11460
    
  94

Hi everyone,

I strongly recommend you check your instructions for the sentence "Any methods that throw RecordNotFoundException should do so if a specified record does not exist or is marked as deleted in the database file.".

It is not a must requirement, but (for those who have a RecordNotFoundException) it sounds like it is something the assessor may check for. All you need is one common method that performs checks for non-existant/deleted records, and have all your public methods call it - simple.

Regards, Andrew
dennis du
Ranch Hand

Joined: Dec 31, 2004
Posts: 59
Andrew, I am behind you.

I just substract all my code to checkExist(int recNo).
just check the RecordNotExistException.
Then almost all the public methods with the exception
will call it.

It is very clear.


-------------------------------<br />OCP 9i <br />SCJP/SCJD/SCWCD(92%)/SCDJWS<br />XML(IBM Test 141)<br />Who is the next?SCBCD<br />SCBCD/CCNA/CCNP/PMP<br />not sure
Dieskun Koper
Ranch Hand

Joined: Aug 15, 2004
Posts: 85
My lock and unlock methods (and not only these methods) check whether the record exists and throw a RecordNotFoundException if it does not, yet I received 44/80.
My locking mechanism would not work if records are created and removed, but my create and delete methods were NOPs (throwing UnsupportedOperationException). I felt I did not need to make a (more complicated) locking mechanism what would work also work in cases my application did not support anyway. I suppose they have something on their checklist saying that the locking should work in all cases and forgot that it would not be logical to do this in cases like mine.
peter wooster
Ranch Hand

Joined: Jun 13, 2004
Posts: 1033
Originally posted by Dieskun Koper:
My lock and unlock methods (and not only these methods) check whether the record exists and throw a RecordNotFoundException if it does not, yet I received 44/80.


Did you check that the record still existed after the lock completed?
Dieskun Koper
Ranch Hand

Joined: Aug 15, 2004
Posts: 85
Hello Peter,

No, I did not. If the record would be removed after the record existence check, while my locking code is running, it will not throw a RecordNotFoundException.
As my delete method is a NOP and my map of records is an unmodifiable (Collections.unmodifiableMap), this should be okay.
If I were to implement the delete method, my locking mechanism won't work. The case you mention is one of several in which it would break.
I did explain this in my choices.txt.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: The Mysterious 44/80 Locking score.