[concurrency-interest] Re: When do you use wait/notify?

Doug Lea dl@cs.oswego.edu
Mon, 26 Jan 2004 20:07:36 -0500

> Actually that's what I tried to ask in one of my last emails.
> If I judge correctly there is no direct connection from a thread to
> a lock object

Sorry to misunderstand what you were asking.
Here's a sketch of one way to build lock tools:

1. Use the new Thread.getAllStackTraces() method
2. Run through traces, looking for ReentrantLock.lock calls
3. Print the locks (the ReentrantLock.toString() shows status.)
   Or use the instrumentation methods to create a waits-for graph 
   to find deadlocks. Or whatever.

Warning: I haven't done this, and don't even know if getAllStackTraces
is fully functional yet, but the intent is to make such tools
possible. (Also, I'm not sure offhand how to get from step 2 to 3
given what StackTraceElement provides.)

> BTW, I'm not able to run the current JSR 166 jar:

Ugh. Sorry. This means that the internal builds I must use to prepare
for beta2 are now incompatible with early-access build.  I should be
able to create a usable jar from some previous build, which I won't be
able to get to for a day or two. I'll post when I do.