• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Separate LockManager Class

 
Javini Javono
Ranch Hand
Posts: 286
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
If I'm not mistaken, I think that I have seen references to some people implementing
a separate LockManager class. That is, instead of calling
Data data.lock(...)
one calls
LockManager lockManager.lock(...)
to carry out higher-level locking, such as:
lock(int recNo = 1000);
String data = read(recNo);
write(recNo, data);
unlock(recNo);
Question 1:
If things are implemented this way, do the lock(), unlock(),
is isLocked() methods in Data remain trivially implemented?
Question 2:
Or, does the Data class delegate the responsibility to the
LockManager class thus:
public void lock(int recNo) throws ... {
lockManager.lock(recNo);
}
Thanks,
Javini Javono
 
Philippe Maquet
Bartender
Posts: 1872
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Javini,
Second option is the way it goes.
Regards,
Phil.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic