aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes [ NO PASS!!! ] - What happen??? 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 "[ NO PASS!!! ] - What happen???" Watch "[ NO PASS!!! ] - What happen???" New topic
Author

[ NO PASS!!! ] - What happen???

Laura Pecoraro
Ranch Hand

Joined: Mar 31, 2009
Posts: 45
Hi all...
today I retrieve my result... the follow the Assessor_1 report:

This report shows the total points that could have been awarded in each section, and the actual number of points you were awarded.
This is provided to give you per-section feedback on your strengths.
The maximum possible score is 400; the minimum to pass is 320.
General Considerations (maximum = 100): 100
Documentation (maximum = 70): 70
O-O Design (maximum = 30): 30
GUI (maximum = 40): 24 ----> I DON'T UNDERSTAND, BUT POSSIBLE
Locking (maximum = 80): 0 -----> WHAT!!! IT'S NOT TRUE!!! (see belowe)
Data store (maximum = 40): 40
Network server (maximum = 40): 40
Major point loss for record-locking mechanism, which is not according to spec.
Your locking code does not block when trying to lock a locked record. It just throws an exception.

I TEST THIS FUNCTIONALITY... WHEN LOCK A LOCKED RECORD AN EXCEPTION IS THOWS ! ! ! I DON'T UDERSTAND...



Laura
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5286
    
  13

Hi Laura,

Sorry to hear that you didn't pass

When you try to lock a locked record, you should certainly not throw an exception. But your thread should give up cpu and start waiting for the record to be unlocked again. So you would have something like:

in your lock-method:


in your unlock-method:


and then you could have following sample application:
a) thread1: lock(1); // locks record 1
b) thread2: lock(1); // thread2 has to wait until thread1 unlocks record 1
c) thread1: update(1, newData); // record 1 is updated with newData and thread2 still consumes no CPU and is in waiting state
d) thread1: unlock(1); // thread1 unlocks record 1 and so all waiting threads are notified (by notifyAll call)
e) thread2: continues where it lefts its execution, so checks if record 1 is locked and record is not locked, so thread2 has locked record 1 and can continue (and in your application thread2 never continued its execution because you throwed an exception in step b).

I hope explanation helps you understanding what you did wrong, so you could correct your assignment and re-submit it. The wait/notifyAll mechanism is just 1 of the possible solutions to take care of this record locking (which i used). If you have andrew's book, just take a very close look to the threading chapter.

Kind regards,
Roel


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
Jason Moors
Ranch Hand

Joined: Dec 04, 2001
Posts: 188
Hi Laura,

It sounds as though you haven't implemented the locking method correctly, the requirement is wait until the record is unlocked, however it sounds like you are throwing an expection is the record is alreay locked, which might explain why you lost points for locking.

// Locks a record so that it can only be updated or deleted by this client.
// If the specified record is already locked, the current thread gives up
// the CPU and consumes no CPU cycles until the record is unlocked
.


Regards,
Jason
Laura Pecoraro
Ranch Hand

Joined: Mar 31, 2009
Posts: 45
Hi Roel De Nijs
thanks very much for your help (and example)... I thinks that I'am very stupid... the Sun specification say
the current thread gives up the CPU and consumes no CPU cycles until the record is unlocked... So, I understand than consumes no CPU cycles to mean NO WAIT CPU, therefore, I throws an exception when try to lock a record locked... and using your esample, the thread2 when try to lock(recNo:2) really throws Exception....

Thanks Laura

Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5286
    
  13

Hi Laura,

If a thread is waiting, it is not consuming any cpu cycles. It's just waiting "on a bench" for (in this case) a record being unlocked. When then the notifyAll is called, the thread goes from that bench to the pool with runnable threads. And then a scheduler picks out 1 thread from this pool and that thread will run and consume a CPU cycle.
You can find here an overview about the different states of a thread.

So when a record is already locked by another thread (t1), the thread (t2) just has to wait until the record becomes available (when t1 unlocks the record). When t2 is notified, t2 tries to get the lock on that record (but maybe there are also a bunch other threads t3, t4, t5,... trying to acquire the lock on that record, so 1 thread will get the lock and the other threads will go back to waiting state) and then continue with the update or delete. In your solution an exception is thrown and the update or delete of t2 will never happen (because the exception is thrown).
I know it's one of the hardest (and most important) parts of the assignment and that's clearly visible in the per-section scores: 80 points is the highest per-section score (except for the 100 on general considerations).

Kind regards,
Roel
Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2265
    
    3

Howdy, Laura.

First, I am extremely sorry to hear that you didn't pass. Indeed, you are not supposed to throw an exception; this way, the locking mechanism wouldn't have much sense. And the explanation provided by Roel explains pretty well the locking process.

In the name of the JavaRanch SCJD forum, I'd like to let you know that we'll do everything we can to help you passing this certification. And by the way, please do not give up. I am 100% sure that, if you fix this problem, you'll pass with a very good grade. Let's be positive and go for it!


Cheers, Bob "John Lennon" Perillo
SCJP, SCWCD, SCJD, SCBCD - Daileon: A Tool for Enabling Domain Annotations
Laura Pecoraro
Ranch Hand

Joined: Mar 31, 2009
Posts: 45
Roberto Perillo wrote:Howdy, Laura.

First, I am extremely sorry to hear that you didn't pass. Indeed, you are not supposed to throw an exception; this way, the locking mechanism wouldn't have much sense. And the explanation provided by Roel explains pretty well the locking process.

In the name of the JavaRanch SCJD forum, I'd like to let you know that we'll do everything we can to help you passing this certification. And by the way, please do not give up. I am 100% sure that, if you fix this problem, you'll pass with a very good grade. Let's be positive and go for it!


Hi Roberto,
thanks about your support

I try to fix my code, and try again exam... but I'am very angry becouse a don't pass for an incomprehension... so I got the max score about all section except for GIU (24 ) and LOCK (0 )....

Laura



K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2419
    
    7

Hi Laura, sorry to hear you didn't pass. For locking, Roel has described the logic behind it already. To test it, you may want to use Roberto's Data class test here. Highly recommended.

For your GUI, I'm sure you can improve that too. I got 39/40 for my GUI, maybe you can have a look at my SCJD comments (from my signature).

The most important thing is locking for SCJD. If you can't get it to work "properly" (eg don't deadlock, don't throw exception, GUI don't hang) then you are good. Good luck


K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7 OCPWCD5
Anne Crace
Ranch Hand

Joined: Aug 29, 2005
Posts: 223
Hi Laura,

Sorry about your bad result I second the idea to use Roberto's test class. I used his as well as a couple other ones. I struggled with this concept, too, due to lack of experience. I understand it pretty well now, after using the test classes and reading about Locking/Unlocking (over and over). You will probably get deadlocks in the beginning, but keep at it, and your code will pass the test. Then you can submit, and YOU will pass the SCJD!


SCJP, SCJD
Laura Pecoraro
Ranch Hand

Joined: Mar 31, 2009
Posts: 45
Thanks all for support and consolation

Hi Laura

Ulises Pulido
Ranch Hand

Joined: Jul 24, 2008
Posts: 81
So when something like this happens what's next? to buy the resubmission assignment or what ?


SCJP 5.0, SCWCD 5.0, SCBCD 5.0, SCJD, SCEA in progress
www.ulisespulido.com
Julio Cesar Marques
Ranch Hand

Joined: Mar 21, 2009
Posts: 67
Owhh Laura... i am really sorry about that!!

It could be happens with everyone... don't worry Ok?

Cherrs!!!
Julio


Julio Cesar Lopes Marques
Sun Certified Java Developer 5, Sun Certified Java Programmer 5
Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2265
    
    3

Ulises Pulido wrote:So when something like this happens what's next? to buy the resubmission assignment or what ?


It's not necessary to take the essay exam again. She just needs to fix the locking part now, resubmit the project, and very very soon she'll be a SCJD.
Laura Pecoraro
Ranch Hand

Joined: Mar 31, 2009
Posts: 45
Ulises Pulido wrote:So when something like this happens what's next? to buy the resubmission assignment or what ?


Hi Pulido...
I can not answer yet ... I'm waiting for a response from the Sun

I plan to pay the submission test again

Hi Laura
Ulises Pulido
Ranch Hand

Joined: Jul 24, 2008
Posts: 81
I hope Laura will be a SCJD soon =)
Jeffry Kristianto Yanuar
Ranch Hand

Joined: Oct 01, 2007
Posts: 759
Are there any news ?

Jeffry Kristianto Yanuar SCJP, SCJA, SCJD
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11462
    
  94

Yes, Laura passed with a great score: 98% on 17th July.


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
 
wood burning stoves
 
subject: [ NO PASS!!! ] - What happen???