Bug 334647 - Show java.util.concurrent locks in debug view
Summary: Show java.util.concurrent locks in debug view
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 3.5   Edit
Hardware: All All
: P3 enhancement with 2 votes (vote)
Target Milestone: ---   Edit
Assignee: JDT-Debug-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-18 09:31 EST by Walter Laan CLA
Modified: 2011-01-19 09:22 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Walter Laan CLA 2011-01-18 09:31:06 EST
Build Identifier: 20100617-1415

You can enable "Show monitors" in the debug view (by choosing view menu -> Java -> Show monitors) but this only shows monitors taken with the synchronized keyword.
It would be nice if other monitor gotten through java.util.concurrent locks are shown as well.

When doing a thread dump with VisualVM this information is displayed so the information should be available for Eclipse as well.

Reproducible: Always

Steps to Reproduce:
import java.util.concurrent.locks.ReentrantLock;

public class TestLockDebug {
    public static void main(String[] args) {
        Object lock1 = new Object();
        ReentrantLock lock2 = new ReentrantLock();
        try {
            lock2.lock();
            synchronized (lock1) {
                try {
                    Thread.sleep(100000);
                }
                catch (InterruptedException ignore) {
                }
            }
        }
        finally {
            lock2.unlock();
        }
    }
}

Running the above program using JDK 6u23 (suspending the main thread after starting it in debug mode):

Eclipse Helios Release Build id: 20100617-1415:
Thread [main] (Suspended)	
	owns: Object  (id=15)	
	Thread.sleep(long) line: not available [native method]	
	TestLockDebug.main(String[]) line: 13	

VisualVM 1.3.1 thread dump:
"main" prio=6 tid=0x003b8400 nid=0x1120 waiting on condition [0x0090f000]
   java.lang.Thread.State: TIMED_WAITING (sleeping)
	at java.lang.Thread.sleep(Native Method)
	at TestLockDebug.main(TestLockDebug.java:13)
	- locked <0x02e60c30> (a java.lang.Object)

   Locked ownable synchronizers:
	- <0x02e6c600> (a java.util.concurrent.locks.ReentrantLock$NonfairSync)