Re: Applets and ThreadGroups (Was: Re: ThreadDeath - How spooky is
that!)
Richard Maher wrote:
What version of Browser, OS, and JVM were you using?
Firefox 3, Vista, Java 1.6 something (the latest).
If it's Java 6, did you have the "classloader_cache" applet parameter set to
true?
Yes. Which is to say I left it at its default value.
<https://jdk6.dev.java.net/plugin2/#CLASSLOADER_CACHE>
Can you please post your Applet code so that I can try here?
It's pretty simple. This code will print "test = 0" when it is loaded
fresh and "test = 1" when it is used from the applet cache:
<CODE>
package testapplet;
import javax.swing.JApplet;
public class TestApplet extends JApplet {
static int test;
@Override
public void init() {
System.out.println( "Init" );
System.out.println( "static int test = " + test );
test = 1;
}
@Override
public void start() {
System.out.println( "Start" );
new Thread() {
@Override
public void run() {
System.out.println( this );
try {
for(;;);
} catch (Error er ) {
System.err.println( er );
}
}
}.start();
}
@Override
public void stop() {
System.out.println( "Stop" );
}
@Override
public void destroy() {
System.out.println( "Destroy" );
}
}
</CODE>
Here's the applet tag I used in the web page:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<h1>Hello World!</h1>
<applet code="testapplet.TestApplet"
archive="AppletOne.jar"/>
</body>
</html>
but if
he's right then you've managed to unload the JVM system class loader while
the browser is still running. How did you do that? Or are you not using the
System Class Loader?
Nope, I just waited for the JVM itself to stop. The plug-in does that
once it is no longer used.
You are running an Applet in a Browser aren't you?
Correct.