--- jsr166/src/test/tck/ThreadLocalTest.java 2011/03/15 19:47:07 1.12 +++ jsr166/src/test/tck/ThreadLocalTest.java 2021/01/26 13:33:06 1.18 @@ -6,32 +6,32 @@ * Pat Fisher, Mike Judd. */ -import junit.framework.*; -import java.util.concurrent.Semaphore; +import junit.framework.Test; +import junit.framework.TestSuite; public class ThreadLocalTest extends JSR166TestCase { public static void main(String[] args) { - junit.textui.TestRunner.run(suite()); + main(suite(), args); } public static Test suite() { return new TestSuite(ThreadLocalTest.class); } - static ThreadLocal tl = new ThreadLocal() { - public Integer initialValue() { + static ThreadLocal tl = new ThreadLocal() { + public Item initialValue() { return one; } }; - static InheritableThreadLocal itl = - new InheritableThreadLocal() { - protected Integer initialValue() { + static InheritableThreadLocal itl = + new InheritableThreadLocal() { + protected Item initialValue() { return zero; } - protected Integer childValue(Integer parentValue) { - return new Integer(parentValue.intValue() + 1); + protected Item childValue(Item parentValue) { + return new Item(parentValue.intValue() + 1); } }; @@ -67,12 +67,12 @@ public class ThreadLocalTest extends JSR child = new ITLThread(x); child.start(); } - Thread.currentThread().yield(); + Thread.yield(); int threadId = itl.get().intValue(); for (int j = 0; j < threadId; j++) { x[threadId]++; - Thread.currentThread().yield(); + Thread.yield(); } if (child != null) { // Wait for child (if any) @@ -90,7 +90,7 @@ public class ThreadLocalTest extends JSR */ public void testGenericITL() throws InterruptedException { final int threadCount = 10; - final int x[] = new int[threadCount]; + final int[] x = new int[threadCount]; Thread progenitor = new ITLThread(x); progenitor.start(); progenitor.join();