Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ApplicationListeners & shutting down in Java 1.4




On Oct 12, 2005, at 10:27 PM, Bill Wagner wrote:

Are either of you guys making direct or indirect calls to System.exit() or Runtime.halt()? If you remember the "old" way to exit a GUI was to put one of these (almost always System.exit()) in a callback. Believe it or not, this was actually a bug. On Java version (I think 1.4.1 and greater) such programs can be terminated without doing this. Terminating a program via System.exit() is kind of like stopping a car by setting off a stick of dynamite in that it takes everything down along with it. IF, and it's a big IF I recall correctly, you can dispose of the GUI elements using dispose() on the parent object and the other threads will continue running until they're done, and then the program will exit (assuming it's supposed to).
Hmmm. I might be. But we're still maintaining support for Java 1.3, so if what you said is correct, we still need System.exit() in some cases. Although we only call it after we've closed all our documents and windows. Then -- once exit(0) is called -- our shutdown hooks take over, and we clean up temp files, etc.

I don't know if this addresses your problem or not.
If anyone can say with more certainty that avoiding System.exit() is going to help address this bug, I'd be happy to try it. But if we're not sure it's at all related... it seems like a lot of work for possibly no gain.

With only 1 person affirming that they've seen the same bug (and nobody confirming that its a known issue)... I'm still weighing in my mind whether this is worth writing up a bug report to Apple...

Morgan Schweers wrote:
Greetings,
On 10/12/05, Jeremy Wood <email@hidden> wrote:
In all our Java 1.4 apps on Mac, we have a minor bug when it comes to
shutting down.
[...deletia...basically either lose changes, or 'cancel' shutdowns...]
The bug is this: in our current implementation, we correctly close the
application when requested, but if the quit is a result of the user's
attempt to log off/shutdown/restart, then we're always told "The
application X has cancelled shutdown/restart/etc."
I have the exact same problem, and I resolve it by apologizing to the
users who report it, and explaining that as far as I know, there's no
real choice in Java on the platform.  :(
Yes, it peeves me (and my users), but I've found no workarounds in a
good bit of searching.  My best approach is to provide a 'Don't show
me this anymore' checkbox, and if the user has selected it (i.e. has
theoretically made a knowledgable choice), always save-and-close,
which can be done w/o queuing a QUIT message to the UI thread.
Anyone else who has a workaround, it'd be great to hear...
--  Morgan Schweers, CyberFOX!
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden
This email sent to email@hidden

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/ email@hidden


This email sent to email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. Java-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden
References: 
 >ApplicationListeners & shutting down in Java 1.4 (From: Jeremy Wood <email@hidden>)
 >Re: ApplicationListeners & shutting down in Java 1.4 (From: Morgan Schweers <email@hidden>)
 >Re: ApplicationListeners & shutting down in Java 1.4 (From: Bill Wagner <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.