Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / December 2005

Tip: Looking for answers? Try searching our database.

Applet Shutdown Problem

Thread view: 
Darol Klawetter - 13 Dec 2005 17:58 GMT
My applet runs in its own window frame after being invoked from a
browser. If I close the applet, the windowClosing event is detected as
it should be. If I close down the browser instead of the applet, then
the applet's windowClosing event is not called even though the applet
closes. I have shutdown code in the windowClosing method and I want
this code invoked whether I close the applet before the browser or the
browser before the applet.

I've tried putting my shutdown code in applet.stop() but the objects I
need for shutdown have already been deallocated and are thus null
values when stop() is invoked.

Any ideas of where I can put my shutdown code?
Vova Reznik - 13 Dec 2005 18:57 GMT
Read this
http://java.sun.com/docs/books/tutorial/applet/overview/lifeCycle.html

What objects are deallocated?

> My applet runs in its own window frame after being invoked from a
> browser. If I close the applet, the windowClosing event is detected as
[quoted text clipped - 9 lines]
>
> Any ideas of where I can put my shutdown code?
Darol Klawetter - 13 Dec 2005 19:41 GMT
Thanks for the link, but it doesn't address my problem.

Regarding your question: The deallocated objects are my
application-specific objects, which are primarily java bean objects. It
appears that they are being unloaded before the applet.stop() is issued.
Alun Harford - 13 Dec 2005 20:30 GMT
> My applet runs in its own window frame after being invoked from a
> browser. If I close the applet, the windowClosing event is detected as
[quoted text clipped - 3 lines]
> this code invoked whether I close the applet before the browser or the
> browser before the applet.

IIRC if somebody closes the browser then they kill the JVM.
I don't think you can do anything about that.

Alun Harford
Darol Klawetter - 13 Dec 2005 21:14 GMT
I've already added a shutdown hook (i.e.,
Runtime.getRuntime().addShutdownHook()) that should get called before
the JVM exits but, for some reason, it's not getting called in this
case.
Roedy Green - 13 Dec 2005 22:18 GMT
On 13 Dec 2005 13:14:55 -0800, "Darol Klawetter"
<darol.klawetter@l-3com.com> wrote, quoted or indirectly quoted
someone who said :

>I've already added a shutdown hook (i.e.,
>Runtime.getRuntime().addShutdownHook()) that should get called before
>the JVM exits but, for some reason, it's not getting called in this
>case.

There is a good chance you need to be signed to do that.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Darol Klawetter - 14 Dec 2005 02:43 GMT
> On 13 Dec 2005 13:14:55 -0800, "Darol Klawetter"
> <darol.klawetter@l-3com.com> wrote, quoted or indirectly quoted
[quoted text clipped - 9 lines]
> Canadian Mind Products, Roedy Green.
> http://mindprod.com Java custom programming, consulting and coaching.

I've given my applet full permission on my machine via the policy file.
Any other ideas?
Darol Klawetter - 14 Dec 2005 16:47 GMT
Any other ideas? Anyone?
Andrew Thompson - 16 Dec 2005 09:00 GMT
> Any other ideas? Anyone?

Browsers cannot be relied upon to call Applet.stop(), it is
that simple.  If you need more control, wrap the applet in JWS,
then you have the more predictable AppletViewer showing the applet.

Signature

Andrew Thompson
physci, javasaver, 1point1c, lensescapes - athompson.info/andrew



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.