Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Locking and client identification

 
Victor Bucutea
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy ,


I'm facing the following pb:



The locking code is supposed to be within that Data class. This means that when a record is locked ( lock(recNo) is called) no other client except the one that invoked the lock() is allowed to update/delete this record.
The question is how can I check in the update() and delete() methods who the client is?

Which raises 2 scenarios :
The stand-alone application, when we would like to reuse the code from the Data class. I would like to avoid passing a parameter to the Data class specifying whether we are in stand-alone mode. We lock a record, and we try to update it. When performing the update, the code checks to see whether that record is locked and is available for this client. How can he do that as in a stand-alone context we only have one client and cannot hold a Map<cliendId,recordId> or something of that kind...

The code in the business layer would be :


The code in the persistence layer would be :





and the second scenario, when running in server mode


The code in the business layer would be :


The code in the persistence layer would be :







 
Roberto Perillo
Bartender
Posts: 2271
3
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy, Victor!

Please take a look here. I think it might be helpful!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic