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

Does the lock method need to check previous lock owner?

 
David Winters Junior
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All,

Just wondering in the lock method is it really necessary to check which client
owned the lock?

In my lock method i have created a lock per record so that only client waiting for that specific lock will be notified. Ive seen other also in their lock methods check whether the previous lock owner had the lock prior to granting the lock to the owner again so in this way the same client cn't have access to the same lock twice in a row...

So my question is if the lock owner can't have the same lock again in succession then what action do we take, how do i prevent this owner from getting access to the lock?
what have others done here?

Thanks,
david
 
Roman Yankin
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by David Winters Junior:
All,

Just wondering in the lock method is it really necessary to check which client owned the lock?


I have not done this, because from my point of view there is simply no point in providing such functionality.

If we are talking about remote implementation of a client (local implementation is allowed to be thread - unsafe ), then such client must never deal with locks. It is server and only server responsibility to provide thread-safety, so it is only server that deals with locks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic