开发者

With Swing & Java, what is done by the "Swing-Shell" thread

开发者 https://www.devze.com 2022-12-20 21:07 出处:网络
with threads & swing, the event queue (event dispatch thread) is broadly presented & disc开发者_如何学运维ussed.

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.

With Swing & Java, what is done by the "Swing-Shell" thread

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号