--- jsr166/src/test/tck/AtomicLongFieldUpdaterTest.java 2009/11/16 05:30:07 1.12 +++ jsr166/src/test/tck/AtomicLongFieldUpdaterTest.java 2009/11/17 06:58:50 1.14 @@ -124,7 +124,7 @@ public class AtomicLongFieldUpdaterTest * compareAndSet in one thread enables another waiting for value * to succeed */ - public void testCompareAndSetInMultipleThreads() { + public void testCompareAndSetInMultipleThreads() throws Exception { x = 1; final AtomicLongFieldUpdatera; try { @@ -133,20 +133,17 @@ public class AtomicLongFieldUpdaterTest return; } - Thread t = new Thread(new Runnable() { - public void run() { - while (!a.compareAndSet(AtomicLongFieldUpdaterTest.this, 2, 3)) Thread.yield(); - }}); - try { - t.start(); - assertTrue(a.compareAndSet(this, 1, 2)); - t.join(LONG_DELAY_MS); - assertFalse(t.isAlive()); - assertEquals(a.get(this), 3); - } - catch (Exception e) { - unexpectedException(); - } + Thread t = new Thread(new CheckedRunnable() { + public void realRun() { + while (!a.compareAndSet(AtomicLongFieldUpdaterTest.this, 2, 3)) + Thread.yield(); + }}); + + t.start(); + assertTrue(a.compareAndSet(this, 1, 2)); + t.join(LONG_DELAY_MS); + assertFalse(t.isAlive()); + assertEquals(a.get(this), 3); } /**