Do I have to explicitly call System.exit() in a Webstart application?

后端 未结 5 1241
心在旅途
心在旅途 2021-01-12 04:49

Recently I converted a Swing application to Webstart. The process was pretty straightforward, but I found that after I close all windows, my application\'s JVM did not termi

相关标签:
5条回答
  • 2021-01-12 05:35

    I experience the same issue with web start. If i turn off java console, the process does not hang up. Any known bug id from Sun?

    0 讨论(0)
  • 2021-01-12 05:36

    The AWT EDT is usually the culprit. For some years now it has had some logic to shutdown when there are no undisposed windows. However, there are recurrent problems with leaks, including within the implementation of AWT and Swing. Therefore, I strongly suggest using System.exit in production releases (you might possibly want to leave it out for some testing to detect leaks).

    The WebStart thread should all be daemon when there are no system windows (console, javax.jnlp services and other dialogs) showing.

    0 讨论(0)
  • 2021-01-12 05:36

    Consider attaching with jconsole and get a look at what the JVM is doing.

    0 讨论(0)
  • 2021-01-12 05:41

    Because of bugs in WebStart, yes. WebStart starts up a "secure thread" for it's own purposes that interacts with the EDT. This SecureThread prevents the automatic termination of the Java process one would expect when all windows and AWT resources are disposed.

    For more information see http://www.pushing-pixels.org/?p=232

    0 讨论(0)
  • 2021-01-12 05:42

    Webstart starts the Console window (you may be able to disable that). The console window is used to see stdout/err of the webstart process as well as rudimentary log/debug but has the side effect of created a top-level AWT/Swing window. Since the AWT/EDT only ends when the LAST window is disposed, the console window is holding up your application. You should probably call System.exit() to be 100% sure your application exits (unless you can gurantee a certain client configuration, webstart console turned off)

    0 讨论(0)
提交回复
热议问题