--- jsr166/src/test/loops/ContextSwitchTest.java 2014/12/31 17:00:58 1.7 +++ jsr166/src/test/loops/ContextSwitchTest.java 2015/10/12 20:16:47 1.9 @@ -37,6 +37,13 @@ public final class ContextSwitchTest { } static final class MyThread extends Thread { + + static { + // Reduce the risk of rare disastrous classloading in first call to + // LockSupport.park: https://bugs.openjdk.java.net/browse/JDK-8074773 + Class ensureLoaded = LockSupport.class; + } + volatile Thread other; volatile int nparks; @@ -56,7 +63,6 @@ public final class ContextSwitchTest { LockSupport.unpark(other); nparks = p; System.out.println("parks: " + p); - } } }