Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

B&S: Lock & Unlock Sun Specification

 
Laura Pecoraro
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2271
3
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!!!
 
Laura Pecoraro
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2271
3
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic