--- jsr166/src/test/tck/AtomicStampedReferenceTest.java 2003/12/29 19:05:40 1.7 +++ jsr166/src/test/tck/AtomicStampedReferenceTest.java 2009/11/16 04:57:10 1.9 @@ -2,8 +2,8 @@ * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/licenses/publicdomain - * Other contributors include Andrew Wright, Jeffrey Hayes, - * Pat Fisher, Mike Judd. + * Other contributors include Andrew Wright, Jeffrey Hayes, + * Pat Fisher, Mike Judd. */ import junit.framework.*; @@ -16,7 +16,7 @@ public class AtomicStampedReferenceTest public static Test suite() { return new TestSuite(AtomicStampedReferenceTest.class); } - + /** * constructor initializes to given reference and stamp */ @@ -97,7 +97,7 @@ public class AtomicStampedReferenceTest final AtomicStampedReference ai = new AtomicStampedReference(one, 0); Thread t = new Thread(new Runnable() { public void run() { - while(!ai.compareAndSet(two, three, 0, 0)) Thread.yield(); + while (!ai.compareAndSet(two, three, 0, 0)) Thread.yield(); }}); try { t.start(); @@ -107,7 +107,7 @@ public class AtomicStampedReferenceTest assertEquals(ai.getReference(), three); assertEquals(ai.getStamp(), 0); } - catch(Exception e) { + catch (Exception e) { unexpectedException(); } } @@ -120,7 +120,7 @@ public class AtomicStampedReferenceTest final AtomicStampedReference ai = new AtomicStampedReference(one, 0); Thread t = new Thread(new Runnable() { public void run() { - while(!ai.compareAndSet(one, one, 1, 2)) Thread.yield(); + while (!ai.compareAndSet(one, one, 1, 2)) Thread.yield(); }}); try { t.start(); @@ -130,14 +130,14 @@ public class AtomicStampedReferenceTest assertEquals(ai.getReference(), one); assertEquals(ai.getStamp(), 2); } - catch(Exception e) { + catch (Exception e) { unexpectedException(); } } /** * repeated weakCompareAndSet succeeds in changing values when equal - * to expected + * to expected */ public void testWeakCompareAndSet(){ int[] mark = new int[1]; @@ -146,11 +146,11 @@ public class AtomicStampedReferenceTest assertEquals(0, ai.getStamp ()); assertEquals(0, mark[0]); - while(!ai.weakCompareAndSet(one, two, 0, 0)); + while (!ai.weakCompareAndSet(one, two, 0, 0)); assertEquals(two, ai.get(mark)); assertEquals(0, mark[0]); - while(!ai.weakCompareAndSet(two, m3, 0, 1)); + while (!ai.weakCompareAndSet(two, m3, 0, 1)); assertEquals(m3, ai.get(mark)); assertEquals(1, mark[0]); }