This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Threads and Synchronization and the fly likes How can one prove that lock has been acquired on an object Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Reply Bookmark "How can one prove that lock has been acquired on an object" Watch "How can one prove that lock has been acquired on an object" New topic
Author

How can one prove that lock has been acquired on an object

shesh anand
Greenhorn

Joined: Feb 10, 2007
Posts: 29
How can one prove that lock has been acquired on an object and funny enough not on thread....stupid is not it!!!
Nitesh Kant
Bartender

Joined: Feb 25, 2007
Posts: 1638

what is there to prove in it?


apigee, a better way to API!
Meghna Bhardwaj
Ranch Hand

Joined: Jun 08, 2007
Posts: 109
Well, there is a static boolean holdsLock(Object obj) method, which will give you a true false if the object is locked.

I just took it as a given, and didnt fight it
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
Note that Thread.holdsLock() is broken in older Java versions, including 1.4. I had used it in various assertions, and kept getting spurious assertion failures.

Thread.holdsLock() works correctly in Java 6.


Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.<br /> <br />#:^P
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How can one prove that lock has been acquired on an object
 
Similar Threads
One more confusion!!
some problems regd threads as in velmurugan's notes
Class Lock in Threads
Mutually Exclusive lock
lock acquired on a class ??