Applet termination question

Discussion in 'Java' started by DennyOR, Nov 8, 2005.

  1. DennyOR

    DennyOR Guest

    When the user closes the applet window, destroy() is called, which runs to
    the end of that method and then program execution terminates...

    Except if the browser is closed (or was already closed) before destroy()
    ends, in which case program execution terminates before destroy() is
    finished executing.

    This prevents my client applet from carrying out a normal sign-off from my
    server application. Is there anything I can do to preserve a normal applet
    termination when the browser is closed early?

    Thanks,
    Denny
     
    DennyOR, Nov 8, 2005
    #1
    1. Advertising

  2. DennyOR

    Benji Guest

    DennyOR, while chewing on bamboo shoots, wrote:
    > When the user closes the applet window, destroy() is called, which runs to
    > the end of that method and then program execution terminates...


    > Except if the browser is closed (or was already closed) before destroy()
    > ends, in which case program execution terminates before destroy() is
    > finished executing.


    > This prevents my client applet from carrying out a normal sign-off from my
    > server application. Is there anything I can do to preserve a normal applet
    > termination when the browser is closed early?


    Without really knowing the answer to your question, I'm going to take an
    educated guess and say no. If the answer was yes, I could make my applet
    persist in memory for as long as I wanted, which would be a really bad
    thing as far as performance goes. Being able to persist your applet
    indefinitely *seems* like it would go against the idea of sandboxing. But
    I could be wrong.

    I would be interested to see if anyone else has any concrete answers for
    you.

    --
    Of making better designs there is no end,
    and much refactoring wearies the body.
     
    Benji, Nov 8, 2005
    #2
    1. Advertising

  3. DennyOR

    Oliver Wong Guest

    "Benji" <> wrote in message
    news:dkr43m$gfp$...
    > DennyOR, while chewing on bamboo shoots, wrote:
    >> When the user closes the applet window, destroy() is called, which runs
    >> to
    >> the end of that method and then program execution terminates...

    >
    >> Except if the browser is closed (or was already closed) before destroy()
    >> ends, in which case program execution terminates before destroy() is
    >> finished executing.

    >
    >> This prevents my client applet from carrying out a normal sign-off from
    >> my
    >> server application. Is there anything I can do to preserve a normal
    >> applet
    >> termination when the browser is closed early?

    >
    > Without really knowing the answer to your question, I'm going to take an
    > educated guess and say no. If the answer was yes, I could make my applet
    > persist in memory for as long as I wanted, which would be a really bad
    > thing as far as performance goes. Being able to persist your applet
    > indefinitely *seems* like it would go against the idea of sandboxing. But
    > I could be wrong.
    >
    > I would be interested to see if anyone else has any concrete answers for
    > you.


    Benji's point makes sense. I just wanted to additionally say that when
    writing client/server applications, you should write code to handle
    unexpected disconnections, because it's fairly typical in a networked
    environment.

    - Oliver
     
    Oliver Wong, Nov 8, 2005
    #3
  4. DennyOR wrote:

    > ..Is there anything I can do to preserve a normal applet
    > termination when the browser is closed early?


    No. You might wrap your applet in JWS to give it a more
    predicatable environment, though.
     
    Andrew Thompson, Nov 9, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. JezB
    Replies:
    3
    Views:
    21,981
  2. Garth17
    Replies:
    0
    Views:
    564
    Garth17
    Mar 16, 2005
  3. Itamar Lev
    Replies:
    4
    Views:
    457
    Itamar Lev
    Sep 4, 2003
  4. Mike Mimic

    Event after thread termination

    Mike Mimic, Jan 11, 2004, in forum: Java
    Replies:
    5
    Views:
    658
    Chris Smith
    Jan 11, 2004
  5. grocery_stocker
    Replies:
    6
    Views:
    321
    Tommi Johnsson
    Jul 23, 2005
Loading...

Share This Page