< prev index next >

test/jdk/java/util/concurrent/forkjoin/FJExceptionTableLeak.java

Print this page
8246585: ForkJoin updates
Reviewed-by: martin

*** 60,74 **** import java.util.function.BooleanSupplier; @Test public class FJExceptionTableLeak { final ThreadLocalRandom rnd = ThreadLocalRandom.current(); ! final VarHandle NEXT, EX; ! final Object[] exceptionTable; ! final ReentrantLock exceptionTableLock; ! FJExceptionTableLeak() throws ReflectiveOperationException { MethodHandles.Lookup lookup = MethodHandles.privateLookupIn( ForkJoinTask.class, MethodHandles.lookup()); Class<?> nodeClass = Class.forName( ForkJoinTask.class.getName() + "$ExceptionNode"); VarHandle exceptionTableHandle = lookup.findStaticVarHandle( --- 60,78 ---- import java.util.function.BooleanSupplier; @Test public class FJExceptionTableLeak { final ThreadLocalRandom rnd = ThreadLocalRandom.current(); ! VarHandle NEXT, EX; ! Object[] exceptionTable; ! ReentrantLock exceptionTableLock; ! FJExceptionTableLeak() { ! // initialize separately to allow to pass with FJ versions without table ! } ! ! void init() throws ReflectiveOperationException { MethodHandles.Lookup lookup = MethodHandles.privateLookupIn( ForkJoinTask.class, MethodHandles.lookup()); Class<?> nodeClass = Class.forName( ForkJoinTask.class.getName() + "$ExceptionNode"); VarHandle exceptionTableHandle = lookup.findStaticVarHandle(
*** 113,122 **** --- 117,131 ---- } } @Test public void exceptionTableCleanup() throws Exception { + try { + init(); + } catch (ReflectiveOperationException ex) { + return; // using FJ Version without Exception table + } ArrayList<FailingTask> failedTasks = failedTasks(); // Retain a strong ref to one last failing task FailingTask lastTask = failedTasks.get(rnd.nextInt(failedTasks.size()));
< prev index next >