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.
- , ?