Search code examples
multithreadingswingawtawt-eventqueue

AWT-EventQueue thread and AWT-Shutdown thread not shutting down


The AWT-EventQueue thread and AWT-Shutdown thread are not shutting down in our application. Is there a debugging technique for finding out why they are not? Any special things to look for?


Solution

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

    • 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.

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