aspose file tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Releasing locks Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Reply Bookmark "Releasing locks " Watch "Releasing locks " New topic
Author

Releasing locks

David Winters Junior
Ranch Hand

Joined: Oct 30, 2007
Posts: 47
All,

I have decided to adapt a locking solution as follows:

I have a seperate LockManager class to handle locking records so that only one
client can modify a record at one time.

In my Lock method i use a solution similar to Andrew MonkHouse whereby each client wanting to modiy a record will wait for a specific condition to be triggered.

i include here andrew's code from his book for the reserve lock method



I have completed the following code for the release lock counterpart of this method in the lock manager class and it works okay with the tests i have completed.

I am looking for some feedback here on what one thinks of this code, is their any issues with it as far as one can see:



Your input would be appreciated

David
Roman Yankin
Ranch Hand

Joined: Aug 27, 2008
Posts: 47
Hi David, honestly this approach is way too complicated, why don't you have just one ReentrantLock and just use lock()/unlock() before/after every operation that requires synchronization?
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Releasing locks
 
Similar Threads
My Locking Method: please, advise me.
Monkhouse: Multiple Notification Objects example
Multiple Notification Points
Denny's DVD ReservationsManager - signal()
The ReservationsManager Class In Monkhouse Book