Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Applet Shutdown Problem

Reply
Thread Tools

Applet Shutdown Problem

 
 
Darol Klawetter
Guest
Posts: n/a
 
      12-13-2005
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?

 
Reply With Quote
 
 
 
 
Vova Reznik
Guest
Posts: n/a
 
      12-13-2005
Read this
http://java.sun.com/docs/books/tutor...lifeCycle.html

What objects are deallocated?

Darol Klawetter wrote:
> 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?
>

 
Reply With Quote
 
 
 
 
Darol Klawetter
Guest
Posts: n/a
 
      12-13-2005
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.

 
Reply With Quote
 
Alun Harford
Guest
Posts: n/a
 
      12-13-2005
"Darol Klawetter" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...
> 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.


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

Alun Harford


 
Reply With Quote
 
Darol Klawetter
Guest
Posts: n/a
 
      12-13-2005
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.

 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      12-13-2005
On 13 Dec 2005 13:14:55 -0800, "Darol Klawetter"
<(E-Mail Removed)> 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.
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
 
Reply With Quote
 
Darol Klawetter
Guest
Posts: n/a
 
      12-14-2005

Roedy Green wrote:
> On 13 Dec 2005 13:14:55 -0800, "Darol Klawetter"
> <(E-Mail Removed)> 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.
> --
> 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?

 
Reply With Quote
 
Darol Klawetter
Guest
Posts: n/a
 
      12-14-2005
Any other ideas? Anyone?

 
Reply With Quote
 
Andrew Thompson
Guest
Posts: n/a
 
      12-16-2005
Darol Klawetter wrote:
> 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.

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

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Applet - server communication - edited code on the applet side - problem! Rune Andresen Java 2 09-17-2003 06:26 PM
Cool Applet Cool Applet http://24.60.235.213/Grid/ Alisher Fatykhov Java 1 08-06-2003 04:32 AM
Re: newbie: Join JApplet & Applet in one applet Andrew Thompson Java 0 08-05-2003 01:41 PM
Re: play wave files using java.applet.Applet webster Java 0 07-20-2003 01:51 PM
applet vs. canvas in applet Rob Love Java 1 07-07-2003 10:07 PM



Advertisments