HI Friends,
I am implementing the LockManager for my assignment at the moment.And after considerable analysis i ahve come accross these three approaches that can be followed for this purpose.They are as follows:-
1)Have my LockManager use the current
thread as the client id for locking authentications.AS i have come accross a lot of posts stating that people have passed using Thread.currentThread instance as client id ,as long as they keep calls to remte methods atomic.That is we have bookSeats on server and client executes it in a single call.
2)Use a seperate Remote object assigned to each client using factory
pattern as client id for locking authentications.LockManager makes use of a HashMap for holding records as keys with remote ref as values.
3)Use a seperate Remote object assigned to each client which maintains its own hashSet of records locked by that client,and also a seperate hashSet of locks maintained by the singleton LockManager containing info about all record locks.A remote object while calling unlock looks in its own hashSet a entry for that record before calling The LockManger unlock.
Which of the above three approaches serve the purpose.Kindly comment!
Thankx.
VikasSood