Skip to main content

Webstart - Shutdown after disposal of Swing Heavyweights

5 replies [Last post]
martinoc
Offline
Joined: 2006-05-05

I have come across a problem in the latest production release of jdk 6 (u6)
A swing application which allows the JVM to terminate when all heavyweight objects are disposed of will not terminate when run under webstart.

I've been able to find the following bugs in the database http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6215269
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6214784

but it is confusing as to the state of this issue. Obviously it is not fixed in the latest production release. Just hoping someone could clarify the situation. Is it fixed in u10?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
kirillcool
Offline
Joined: 2004-11-17
martinoc
Offline
Joined: 2006-05-05

The workaround in the link suggests the use of EXIT_ON_CLOSE.

In my situation that is not possible. My frames actually DO_NOTHING_ON_CLOSE and delegate to a controller object during the windowClosing event. Only this controller object can decide when to close as only it knows enough about the state of the application to know when to do so via a call to dispose on the EDT. The other alternative mentioned: - I certainly dont want to go and forcibly stop webstart threads since i would like my application to run outside of webstart also.

My only option thus far was to use System.exit() which is far from ideal, which findbugs flags as being a dodgy practice.

mthornton
Offline
Joined: 2003-06-10

How about a daemon thread monitoring the number of frames and other threads, but which ignores the special webstart thread? That can then call System.exit(0).

martinoc
Offline
Joined: 2006-05-05

I should not need a daemon thread to call System.exit(). In fact, I should not need to call System.exit() at all. When I run the application locally, the VM will exit when it should, according to the AWT Threading policy.

As currently implemented, Webstart does not honor this policy, and seems to require a call to System.exit(). Therefore, IMO webstart is broken.

There seems to have been a bug which addresses this issue, which was linked to in my initial posting. The status of the bug is Fix Delivered, but it does not seem to have (yet) made it into a release. I was wondering if someone could clarify the situation wrt to that bug.

mthornton
Offline
Joined: 2003-06-10

I agree it is a bug, I was just suggesting a possible workaround to use until the fix is delivered.