Could java.util.concurrent.lock.Lock detect deadlocks caused by two threads acquiring the same locks in a different order?
Could it use a static list of all threads that have locks and ThreadLocal locks lists to know about all in use locks and then check for incorrect order when lock() is called.
In lock:
Check the ThreadLocal list and if there are no other locks then proceed.
Else if there are other locks then look through other threads to determine if any have any of the same locks in a different order.
Add current lock to ThreadLocal list.
In unlock:
Remove current lock from ThreadLocal list.
My thoughts as an enterprise Java developer.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment