< prev index next >
test/jdk/java/util/concurrent/forkjoin/FJExceptionTableLeak.java
Print this page
8246585: ForkJoin updates
Reviewed-by: martin
@@ -60,15 +60,19 @@
import java.util.function.BooleanSupplier;
@Test
public class FJExceptionTableLeak {
final ThreadLocalRandom rnd = ThreadLocalRandom.current();
- final VarHandle NEXT, EX;
- final Object[] exceptionTable;
- final ReentrantLock exceptionTableLock;
+ VarHandle NEXT, EX;
+ Object[] exceptionTable;
+ ReentrantLock exceptionTableLock;
- FJExceptionTableLeak() throws ReflectiveOperationException {
+ 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,10 +117,15 @@
}
}
@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 >