aspose file tools
The moose likes Threads and Synchronization and the fly likes Managing Multiple Locks Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Reply Bookmark "Managing Multiple Locks Problem" Watch "Managing Multiple Locks Problem" New topic
Author

Managing Multiple Locks Problem

Jerson Chua
Ranch Hand

Joined: Feb 08, 2000
Posts: 68
Hi Java Gurus...
I have implemented a lock manager which basically keep tracks of exclusive locks. I've found a bug but don't know how to fix it. Please help me if you know the solution. I am really desperate for some help.
Here's a part of my source code. The problem is inlined as comments.

[This message has been edited by Jerson Chua (edited March 14, 2001).]
Hi,


Please use [ code] [ /code] tags to format your code. Check out the UBB Code link below for further details



Thanks
[This message has been edited by Rahul Mahindrakar (edited March 14, 2001).]
Rahul Rathore
Ranch Hand

Joined: Sep 30, 2000
Posts: 324
Jerson,
What was the need for a separate lock.acquire()? Would'nt it be better if put() into a mapOfLocks signifies the acquisition of locks? i.e. all locks put() in mapOfLocks must be acquired locks, otherwise they are not acquired. I think it is difficult to answer without seeing the rest of your code, and the purpose of you design? Which object calls lock() and for what purpose? What is the code of acquired()? What are the conditions under which a lock() is acquired and how/why are these conditions different from the conditions in which the lock is put() into the mapOfLocks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Managing Multiple Locks Problem
 
Similar Threads
Locking strategy
[B&S] Thread safe access of db file
Please explain
URLyBird Locking Inquiry
Synchronized method/blocks.....???????