8038468: java/lang/instrument/ParallelTransformerLoader.sh fails with ClassCircularityError
Add check null for loader in transform to avoid when loading a class in callback handler for boot loader, CFLH set early enough to catch classes needed during class loading, i.e. sun.misc.URLClassPath$JarLoader$2 seen in the failure. Reviewed-by: acorn, sspitsyn
This commit is contained in:
parent
cd0bc39ec5
commit
2ae66a0f29
@ -79,24 +79,15 @@ public class ParallelTransformerLoaderAgent
|
||||
throws IllegalClassFormatException
|
||||
{
|
||||
String tName = Thread.currentThread().getName();
|
||||
// In 160_03 and older, transform() is called
|
||||
// with the "system_loader_lock" held and that
|
||||
// prevents the bootstrap class loaded from
|
||||
// running in parallel. If we add a slight sleep
|
||||
// delay here when the transform() call is not
|
||||
// main or TestThread, then the deadlock in
|
||||
// 160_03 and older is much more reproducible.
|
||||
if (!tName.equals("main") && !tName.equals("TestThread")) {
|
||||
System.out.println("Thread '" + tName +
|
||||
"' has called transform()");
|
||||
try {
|
||||
Thread.sleep(500);
|
||||
} catch (InterruptedException ie) {
|
||||
}
|
||||
}
|
||||
|
||||
// load additional classes when called from other threads
|
||||
if (!tName.equals("main"))
|
||||
// Load additional classes when called from thread 'TestThread'
|
||||
// When a class is loaded during a callback handling the boot loader, we can
|
||||
// run into ClassCircularityError if the ClassFileLoadHook is set early enough
|
||||
// to catch classes needed during class loading, e.g.
|
||||
// sun.misc.URLClassPath$JarLoader$2.
|
||||
// The goal of the test is to stress class loading on the test class loaders.
|
||||
|
||||
if (tName.equals("TestThread") && loader != null)
|
||||
{
|
||||
loadClasses(3);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user