• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

LockManager

 
Alan Morgan
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,

I've seen a LockManager mentioned on here and I was just wondering what responsibilities this class has in yer implementations ?

Thanks,
Alan.
 
Darya Akbari
Ranch Hand
Posts: 1855
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Alan,

the LockManager or whatever one can call this class , is responsible for the implementation of your data interface's lock and unlock methods.

Regards,
Darya
 
Alan Morgan
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Darya Akbari:
Hi Alan,

the LockManager or whatever one can call this class , is responsible for the implementation of your data interface's lock and unlock methods.

Regards,
Darya


So I have LockManager hold onto my HashMap which contains my locks.
And my lock and unlock methods become simply pass through methods to the LockManager ?.

And that raises another slightly related question.
Given that my Data class is a singleton and it is the only class that will access the LockManager is it overkill to make the LockManager a singleton as well.
Or is it better design to do it anyway given that further down the line if I decide to stop Data being a singleton LockManager is still properly implemented ?

And can I now have my create synchronize on LockManager the way it did on lockMap ?
[ May 31, 2005: Message edited by: Alan Morgan ]
 
Reza Rahman
author
Ranch Hand
Posts: 580
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alan:

As you probably know, all of these are questions to which there are really no right or wrong answers. You should do what best makes sense to you and proceed accordingly.

My situation: My data class is a Singleton, the LockManager isn't. The data class's create method is currently declared synchronized, although I am in the middle of reviewing this choice right now myself.

Reza
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic