Problem: Sometimes we run into deadlock when trying to reload FX applet, especially with FX applet that uses a custom progress bar.
The problem is when we try to load a JAR from the cache to verify the JAR signers/certs, we read the signer/certs from the cache index file. The signer/certs are store serialized in the cache index file. When we read it back out, we need to de-serialize it. During de-serialization, we call into
java.io.ObjectInputStream.resolveClass, and it triggers classloading with:
Class.forName(name, false, latestUserDefinedLoader());
The latestUserDefinedLoader() is returning our plugin/javaws classloader here, causing the deadlock we see when some other threads are doing class/resource loading using the same pluing/javaws classloader.
Fix: Fix is to override ObjectInputStream.resolveClass in CacheEntry, and just use:
Class.forName(name, false, ClassLoader.getSystemClassLoader());
It works here because we know all the cert/signer classes can be loaded by the system classloader.
Manual test case: Run this applet many times and ensure no hang is seen: http://javaweb.sfbay.sun.com/~ngthomas/mchang/reversi2.html