Thread group disposal question

Artem Ananiev Artem.Ananiev at Sun.COM
Thu Aug 21 06:26:58 PDT 2008

Hi, hotspot team,

(I'm not sure if hotspot-runtime-dev is a right alias for the questions 
like this, but I haven't found anything better)

my question is about the right way to destroy a Thread or ThreadGroup. 
In a few words, some application periodically creates and destroys 
instances of sun.awt.AppContext (which roughly corresponds to a 
ThreadGroup instance). After a small number of iterations application 
just hangs - the stack trace is attached.

The log shows a number of threads waiting for Unsafe.park() calls. I 
suspect this happens because AppContext class stops all the threads in 
its ThreadGroup with ThreadGroup.stop() and then destroys the group 
itself with ThreadGroup.destroy(). If any details are required, this 
code can be easily found in JDK source tree:


The question is whether the hang can be caused by using these unsafe 
methods, and whether I can workaround it in any way.


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: stacktrace.txt

More information about the hotspot-runtime-dev mailing list