How to check if a thread holds lock on a particular obj
Tutorials Shared by the Internet Community
Total Hits - 33010
Total Votes - 116 votes
Vote Up - 53 votes
Vote Down - 63 votes
Domain - javarevisited.blogspot.com
Category - JAVA/Core JAVA
Submitted By - Javin Paul
Submitted on - 2011-08-20 02:31:25
Think about a scenario where you would have to find at run time that whether a thread has lock on a particular object e.g. find out whether thread NewsReader has lock on NewsPaper object or not ?
If this questions came in any interview then I would automatically assume that there could be at least two answer one is hard earned raw answer which programmer would like to figure out based on fundamentals and other could be some rarely used API calls which is available in java , by the way this is actually asked to me in an interview of one of the biggest global bank. More detail...