I didn't even know that you can check if a Thread already holds lock before this question hits me in a telephonic round of Java interview. There is a method called holdsLock() on java.lang.Thread, it returns true if and only if the current thread holds the monitor lock on the specified object.
-
Previous Java ProgrammingHow do you take thread dump in Java?
-
Next On Java Programming
No Comment to " How do you check if a Thread holds a lock or not "