Why does Firefox finish my applet in 20 seconds?

I have a simple applet on such a web page. (This is a test case cut from a more complex applet.)

package test;

import java.applet.Applet;

@SuppressWarnings("serial")
public class SimpleLoopApplet extends Applet
{
    public void init()
    {
        System.out.println("SimpleLoopApplet invoked");
        try
        {
            while (true)
            {
                try
                {
                    System.out.println("Sleep for 1 second");
                    Thread.sleep(1000);
                }
                catch (InterruptedException e)
                {
                    System.out.println("Applet thread interrupted while sleeping");
                }
            }
        }
        finally {}
    }
}

In Firefox 3.6.8, this applet will run on one computer for 20 seconds and then quit abruptly as if the virtual machine is shutting down (the java console will disappear, the Java icon will remain in the system tray until I go through it, finally block will never be reached).

He is consistently 20 seconds. 20 “Sleep mode for 1 second” printed from the above code, if I extend sleep mode to 5 seconds, then 4 messages will be printed before printing.

In IE and Chrome on the same computer, the cycle will continue indefinitely, as it will be in Firefox 3.6.8 on another computer.

- , ?

+3
3

tutorial

init

init , . init , . , , init. init , .

start

, ( ) . . - . .

, .

+4
Can anyone suggest why the applet might terminate in this way?

, - . start, -.

Javadoc init()

Applet , . , init .

, , init().

+1

There are errors to enable firefox .

The only solution I found is to use java less than 1.6_21. Starting with version 1.6_21, Firefox 3.0 and 3.6 are broken. Fortunately, everything should work in firefox 4.

+1
source

Source: https://habr.com/ru/post/1762441/


All Articles