How do you check if a Thread holds a lock or not

Compiled By Unknown - No Comments
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.

Tags:

No Comment to " How do you check if a Thread holds a lock or not "