From 2ae66a0f292cab0cbebe6b8f891dad2e53693731 Mon Sep 17 00:00:00 2001 From: Yumin Qi Date: Wed, 26 Nov 2014 15:33:43 -0800 Subject: [PATCH] 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 --- .../ParallelTransformerLoaderAgent.java | 25 ++++++------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/jdk/test/java/lang/instrument/ParallelTransformerLoaderAgent.java b/jdk/test/java/lang/instrument/ParallelTransformerLoaderAgent.java index 96f4900b6d7..26a5801a908 100644 --- a/jdk/test/java/lang/instrument/ParallelTransformerLoaderAgent.java +++ b/jdk/test/java/lang/instrument/ParallelTransformerLoaderAgent.java @@ -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); }