Hi Grifith,
Originally posted by Griffith:
Vikas:
My design for LockManager is quite similar to yours, with a seperate class and interface within suncerify.db.
One difference: I elected to synchronize the lock/unlock methods within my LockManager class, instead of synchronizing the HashMap itself. By implemented the LockManager as a sungleton, I'm guaranteeing only one instance per JVM.
I'm not sure of the advantages of either approach ...
I have some questions for u regarding ur design.
1)Why are u keeping ur lockmanager in db package,i think we need to put it in the server as we are going to use the locking mechanism only in remote mode,i think we should put this class in server package only.
2)Why are u synchronizing the lock-unlock methods as a whole ? i think if we synchronise them as a whole then it means that multiple clients using lockmanager implemented as singleton will have to wait top acuire a lock on lockManager object before being able to get a lock on a record,while in my case they get to enter the method and get to do locking in a more appropriate way .
And also we all know that it is always better to have a small synchronized block blocking clients access to some resources instead of having a whole method being blocked.There still might be some operations in a method which do not require any synchronization and can be carried out without an object lock.
Hope it helps.
VikasSood