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