With Swing & Java, what is done by the "Swing-Shell" thread
with threads & swing, the event queue (event dispatch thread) is broadly presented & disc开发者_如何学运维ussed.
However, when examining the thread states with a Swing application, there's also a thread named Swing-Shell. With brief googling I couldn't find much details, mostly thread stack traces with bug reports etc.
Can somebody describe shortly what that thread does. Or even better, does somebody have some link to some documentations
EDIT: I was asking too fast without enough details, sorry. I was going though various JFileChooser issues and a thread named "Swing-Shell" occurs there, having something to do with Windows COM services for file system. A sample stack trace within a deadlock problem can be found at Sun Bug #6741890. (The thread stack trace starts with sun.awt.shell.Win32ShellFolderManager2$ComInvoker$3.run).
With closer inspection with jconsole, I noticed that the thread isn't present there until I have used JFileChooser (JFileChooser for example; the Swing-Shell thread will probably be started by any components using Win32ShellFolderManager) The thread seems to exist also after the usage of JFileChooser.
So, answering to myself, the thread seems to be a separate thread used for COM services with file-related operations (with Windows only? ). If somebody can provide more details, welcome =)
The number, purpose and naming of initial threads is implementation dependent. On my platform, the event dispatch thread (EDT) is named AWT-EventQueue-0
.
Addendum: The only other reference I found says, "A Motif application uses a shell widget to communicate with the window manager." Are you using a Swing library of some kind?
As suggested above, a thread dump might be illuminating. Recent versions of NetBeans' profiler include a save button; I've attached a snapshot of the threads in a typical busy demo.
精彩评论