What free tools are available to analyze lock contention in java?

java, locking, multithreading

Solution

you can use jconsole or jstack both in the bin directory of your JDK. The jconsole in particular allows you to connect to your process and monitor the threads including which resources they have locked, and it can help you identify a deadlock state.

Problem

I need to determine which locks are the most-contended-for in my application code. What free tools can I use to determine this ?

Original source