且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

AWT-EventQueue 线程和 AWT-Shutdown 线程未关闭

更新时间:2021-09-17 22:17:14

如果你的意思是关闭所有窗口后JVM没有正常退出,那么看以下几点:

If you mean that the JVM doesn't exit properly after closing all windows, then look at the following points:

  • 检查所有窗口是否已正确处理,而不仅仅是简单地隐藏起来;其中包括由 Swing(或 AWT)作为无所有者对话框的所有者创建的不可见窗口.为此,您可以检查 Window.getWindows()
  • 确保在处理完所有窗口后没有活动的Thread(守护进程除外)
  • 确保您的应用程序不是由 Java Web Start 启动的,因为在这种情况下您必须调用 System.exit(0)(这是 JWS 的已知错误)
  • check that ALL windows have been disposed properly, not just simply made invisible; that includes the invisible window created by Swing (or AWT) as the owner of ownerless dialogs. For this you can check Window.getWindows()
  • make sure you have no active Thread (except daemons) after disposing of all windows
  • ensure that your application was not launched by Java Web Start, because in this case you must call System.exit(0) (that's a known bug of JWS)

希望这有助于回答您的问题.

Hope this helps answer your question.

此外,最近还有这个SO问题关于垃圾收集摆动窗户.

Besides, there was also this SO question recently about garbage collection of Swing windows.