Locking graphs in JProfiler

Friday, November 27, 2009 | Posted by

In the screencast below, I present some of the features in the locking graphs that have been introduced in JProfiler 6.

The test class that is profiled in this screen cast is given below:

public class MonitorTest {

// The only monitor that all threads are blocking or waiting on
private static final MonitorTest monitor = new MonitorTest();

public static void main(String[] args) throws InterruptedException {

// All threads execute this runnable, each thread acquires the
// monitor, works for 3 seconds and then waits on the monitor
Runnable runnable = new Runnable() {
public void run() {
synchronized (monitor) {
try {
// Instead of doing any real work, the thread just
// sleeps for 3 second
} catch (InterruptedException e) {


// 3 threads are started with an offset of 500 ms
new Thread(runnable, "Test Thread 1").start();
new Thread(runnable, "Test Thread 2").start();
new Thread(runnable, "Test Thread 3").start();

// After 20 seconds, all threads are woken up and the test class
// terminates
synchronized (monitor) {