--- jsr166/src/test/tck/ForkJoinPoolTest.java 2015/10/13 21:18:28 1.70 +++ jsr166/src/test/tck/ForkJoinPoolTest.java 2016/09/15 01:18:01 1.71 @@ -24,6 +24,7 @@ import java.util.concurrent.Future; import java.util.concurrent.RecursiveTask; import java.util.concurrent.RejectedExecutionException; import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.locks.ReentrantLock; import junit.framework.AssertionFailedError; @@ -57,13 +58,6 @@ public class ForkJoinPoolTest extends JS // Some classes to test extension and factory methods - static class MyHandler implements Thread.UncaughtExceptionHandler { - volatile int catches = 0; - public void uncaughtException(Thread t, Throwable e) { - ++catches; - } - } - static class MyError extends Error {} // to test handlers @@ -74,9 +68,9 @@ public class ForkJoinPoolTest extends JS static class FailingThreadFactory implements ForkJoinPool.ForkJoinWorkerThreadFactory { - volatile int calls = 0; + final AtomicInteger calls = new AtomicInteger(0); public ForkJoinWorkerThread newThread(ForkJoinPool p) { - if (++calls > 1) return null; + if (calls.incrementAndGet() > 1) return null; return new FailingFJWSubclass(p); } }