Laura Pecoraro

Ranch Hand
+ Follow
since Mar 31, 2009
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Laura Pecoraro

Hi all ,
today I get my result...finally...I pass SCJD with 393/400 score ! ! !



A special thanks to Roberto Perillo, K. Tsang and Roel De Nijs, for helped me with useful advice and java tips ! ! !

Thanks JavaRanch ! ! !



Laura
11 years ago
Hi Roberto ,

When I asked the right to upload my solution, I wrote specifically "resubmission" into e-mail send on who2contact (Sun Support)...

Laura

Roberto Perillo wrote:

Roel De Nijs wrote:Did you clearly say that it's a resubmission, so you don't have to take the essay exam again?



Hum... I don't think that should be necessary, because the voucher she got for that is specifically for resubmissions. There should be no problem.
Now, Laura, you have to email them again, saying that it is just a resubmission. It's likely that they will ask for your voucher number or something, so they can be sure it is a resubmission. After that, I think you'll be able to resubmit your project.

Hi,
into database by Sun does not say "pending" about my solution (as like the first time)...

When I asked permission to upload my solution they told me to schedule and take the essay exam

This is my doubts...

Laura



Roel De Nijs wrote:

Laura Pecoraro wrote:for testing my locking mechanism, I use same test unit, and I thinks to be safe


I hope for you it is ok this time, so you finally will be a SCJD too.

Laura Pecoraro wrote:But, I have not received any confirmation


And about which confirmation are you having doubts ?

Kind regards,
Roel

Hi Roel De Nijs,
for testing my locking mechanism, I use same test unit, and I thinks to be safe

For buy a resubmission voucher, I used an offer by Sun (I can resubmit without buy an additional voucher), and I received permission to upload my solution on assignment database (I do today)...

But, I have not received any confirmation

This is my dub

Hi Laura


Roel De Nijs wrote:Hi Laura,

Did you thoroughly test your locking mechanism? Did you use some kind of test case to test your locking mechanism, to be 100% sure it is ?

I guess you have to first buy a resubmission voucher by sun. Then you have to request uploading rights to the assignment database (like you had to do before uploading your assignment the first time) before you can upload your assignment a 2nd time. And then I guess you have to wait 4 weeks (don't know if a resubmission is graded with primacy).

But this is just all a guess (except for the resubmission voucher, because that one you certainly need to buy), so if you want to know for sure you can send an email to who2contact.

Good luck with the resubmission!
Kind regards,
Roel

Hello All,
today I "re"-submit my solution (fix the errors into previous version)... but, now, what happens? what should I do yet?

In the "Sun database" not written anything about my resubmit...

I have to wait another 4 weeks to get the result?

Thanks.

Laura

Roberto Perillo wrote:Howdy, Laura!


Lock(#1) -> ( do something ) -> Unlock(#1) ---> ( no problem )



Alright!


Unlock(#1) ---> ( the record #1 exists but not lock by someone... I must thows an Exception???... I must warn the caller's method that specified record not locked )



Very well observed. In my case, I throw an IllegalStateException in this case.


Lock(#1) -> Update(#1) -> Unlock(#1) ---> ( no problem )



Alright!


Lock(#1) -> Delete(#1) -> Unlock(#1) ---> ( the Sun specification about the unlock method says: Releases the lock on a record... its OK, but the signature have a RecordNotFoundException, so, I can not lock a record that will be removed Suggestions???)



So basically the question is "how can I unlock a record if it was already deleted?". In my case, I just verify if the record exists in the Map that controls the locked records. If it doesn't exist, then I throw a RecordNotFoundException. You may also choose to throw an IllegalStateException and not to throw a RecordNotFoundException. Since this is one of the ambiguous points of this certification, I advise you to mention your choice in your choices.txt file.



Thanks Roberto...
Hi all...

I tried to fix my locking mechanism... BUT... I do have some doubt about the delete and unlock methods...

See below

Lock(#1) -> ( do something ) -> Unlock(#1) ---> ( no problem )

Unlock(#1) ---> ( the record #1 exists but not lock by someone... I must thows an Exception???... I must warn the caller's method that specified record not locked )

Lock(#1) -> Update(#1) -> Unlock(#1) ---> ( no problem )

Lock(#1) -> Delete(#1) -> Unlock(#1) ---> ( the Sun specification about the unlock method says: Releases the lock on a record... its OK, but the signature have a RecordNotFoundException, so, I can not lock a record that will be removed Suggestions???)

Laura






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

Roberto Perillo wrote:

Laura Pecoraro wrote:but, I am very doubtful I don't know what to do



Alright, first things first

Indeed, you should not call lock/unlock within update/delete. These are supposed to be used by the services you offer to the users. So, booking a room means lock/update/unlock a record, performed by a method you offer in your services layer.

Also, it is pretty likely that you only need to fix the locking mechanism to be a SCJD without changing the other scores. But I think that the grade might not be exactly the same if another assessor looks at your assignment this time. So, you could just quickly review the other stuff, just to make sure (there are some little things I would do differently today, if I had to do it again).



Hi Roberto... You have convinced me...

Thanks Laura

Roel De Nijs wrote:Hi Laura,

Your update/delete method should not lock/unlock the record in my opinion. to update a record you have to make 3 calls (without the use of a lockCookie):


your update method should first check if the record is correctly locked (that is: locked by the thread that wants to do the update) and then update the actual values (or when thread does not own lock on the record throw an IllegalStateException or like Roberto already said a SecurityException if your interface has such an exception).

So you will have to change your Data class implementation a bit (and probably your server and your client also a bit, because you need 3 calls to update a record and according to your explanation you have just 1 call, a call to update). Don't think you have to do a complete make-over of your data class or your server or ... because the per-section scores were more than good enough

Kind regards,
Roel



Hi Roel...

Your observation is correct , but, in the "Assessor_1 report" I loss points only into record-locking mechanism... then, I thought about modifying only this section to don't change the previous score... but, I am very doubtful I don't know what to do




Hi Roberto...

I try to use Tests-Data-Class... I like its

But I have a questions... my update methods "Lock" and "Unlock" automatically the record... This is a problem???

And at last... My score in "per-section" is good ( except by locking mechanism ) then I modify/fix ONLY lock & unlock methods or modify all my Data class implemetation??? (my data score is 40 (max 40))

Thanks Laura...
Hi all

I try to fix my locking mechanism, but, I have some dubious

So, see follow esample:

#1
T1 -> Lock(1)
T2 -> Lock(1) -> Wait...
T1 -> Unlock(1)
T2 -> Restart... -> Lock(1)
This is easy (finally I understand the specification)

#2 (first dubs)
T1 -> Lock(1)
T2 -> Unlock(1) -> I can throws an Exception???

#3 (second dubs)
T1 -> Lock(1)
T2 -> Lock(1) -> Wait...
T1 -> Loop... ... ...
The thread n.2 (T2) wait until the T1 finished (possibility of death-lock ), or, I can implements a time-out waiting??? For example 5 second, and if resource (record) is alredy locked by someone I throws an Exception???

#4 (third dubs)
T1 -> Lock(1)
T1 -> Lock(1) -> The thread n.1 (T1) try to lock some record... what happen??? I throws an Exception, or, I continued and to do nothing???

Hi Laura and Thanks for helps




Thanks all for support and consolation

Hi Laura

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



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