Threading troubles

Ok, first thing, this is work related (I get an excuse to check the forums at work now :)), if you don’t like work related questsion on forums, please exit now :).

A while back there was a topic to do with getting the stack trace from an active thread group. I’m faced with a problem where I need to find and count all the threads in a group that are in the wait() method, and maybe process what it is they are waiting on. I’ve seen this when doing a ctrl-break and see the wait and the lock listed, what I would like is a programatic way to do this, or some other way to find the threads that are in wait state. I tried searching for the thread but didn’t find it, I guess I got the wrong keywords/author.
Any ideas ?

Cheers

Endolf

(I was going to post this in newless cluebies, but It’s got nowt to do with games and the forum heading for this one is 'Talk about non game development topics here! ', and this aint game dev :))

I think you mean that thread:
http://www.java-gaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=2D;action=display;num=1063619239;start=19#19

Thread.dumpStack() <- That one right? :slight_smile:

Hi
I’m not sure it was, it was a while ago so I don’t remeber how much of the info I thought was in the thread was there, and how much I imagined :). The problem with Thread.dumpStack is that it doesn’t dump it to a stream I pass it. This means I can’t grab it, and as I have multiple threads, redirecting sys out or sys err just to get the output seems a little on the nasty side :). More importantly, it only dumps the stack of the thread that is executing the call.
Thanks for looking though.

Endolf

Hi
I figure a little more background could be usefull on this one :).
I’m trying to write a junit test for some pooling code I wrote, I need to check that threads are waiting for objects from the pool when they are all out (I configure the pool to 10 objects, and then run 150 threads to try and get them, that should just about make sure there are at least 11 threads running by the time I manage to jump in there :). I have to test the release code, so I can’t go dumping debug statements in it (I’ve already tested that far).

HTH

Endolf