This content has been marked as final. Show 3 replies
You can't. If there would be a precise definition what a deadlock looks like, java could prevent or solve it itself. But it can't.
This is the nasty part of multithreading: errors don't have to be deterministic. You have to make sure that no deadlock can happen, BEFORE it happens!
Depends on what you mean by "deadlock" (database transaction, "synchronized" keyword, general deadlock detection) and "detect" (static, dynamic).