*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes B&S: Lock & Unlock Sun Specification Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "B&S: Lock & Unlock Sun Specification" Watch "B&S: Lock & Unlock Sun Specification" New topic
Author

B&S: Lock & Unlock Sun Specification

Laura Pecoraro
Ranch Hand

Joined: Mar 31, 2009
Posts: 45
Hello all...

I have dubious about my Sun specifiation for Lock and Unlock methods...

The specification says:



The doubtful is :
If the Thread-1 lock the record 1, the Thread-2 can unlock the record 1... The specification throws only RecordNotFoundException (non a LockException for example)... I deduce that is possible lock/unlock records independently

Some piece of advice me

Hi Laura
Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2258
    
    3

Howdy, Laura!!!

There is one thing you have to notice, only the client that locked a record can unlock it. So, before unlocking a record, you have to verify if the client that is trying to unlock it owns its lock. And for that, you'll somehow have to identify clients. Please take a look at this thread, where I address my approach to identify clients. If you still have other doubts, please let us know!!!


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
Hi Roberto, and thanks for reply

I read the your Topics... but you writes



So... I don't understand... You have modify the Lock segnature specified by Sun or its original ???

My lock segnature is:



I can't modify its

Can you clarification to me??? Thanks.

Laura
Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2258
    
    3

Howdy, Laura!!!

You have modify the Lock segnature specified by Sun or its original ???


God, no!!!

This method is from the interface I created for my server, which uses the Data class. So the interface of my server has this method, but we certainly can't change the interface that was provided to us. In my server, I use the Data class, where I also added a few extra methods (by creating a new interface that extends Sun's interface).
Laura Pecoraro
Ranch Hand

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

You have modify the Lock segnature specified by Sun or its original ???


God, no!!!

This method is from the interface I created for my server, which uses the Data class. So the interface of my server has this method, but we certainly can't change the interface that was provided to us. In my server, I use the Data class, where I also added a few extra methods (by creating a new interface that extends Sun's interface).


Hi Roberto and good morning (in Italy)

Thanks for help... I understand

For create my "coockie" I used the Thread properties
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: B&S: Lock & Unlock Sun Specification
 
Similar Threads
Something wrong with lock() method signature ?
blocking the code /application
B&S 2.3.1 - Identifying clients uniquely in RMI
Question about lock()
isLock(int):boolean method and the synchronized block