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.
Subscribe to:
Post Comments
(
Atom
)
No Comment to " How do you check if a Thread holds a lock or not "