--- jsr166/src/test/tck/AtomicReferenceFieldUpdaterTest.java 2004/01/20 20:20:56 1.8 +++ jsr166/src/test/tck/AtomicReferenceFieldUpdaterTest.java 2005/05/25 14:27:37 1.10 @@ -76,10 +76,28 @@ public class AtomicReferenceFieldUpdater assertEquals(one,a.get(this)); a.set(this,two); assertEquals(two,a.get(this)); - a.set(this,-3); - assertEquals(-3,a.get(this)); - + a.set(this,m3); + assertEquals(m3,a.get(this)); } + + /** + * get returns the last value lazySet by same thread + */ + public void testGetLazySet(){ + AtomicReferenceFieldUpdatera; + try { + a = AtomicReferenceFieldUpdater.newUpdater(AtomicReferenceFieldUpdaterTest.class, Integer.class, "x"); + } catch (RuntimeException ok) { + return; + } + x = one; + assertEquals(one,a.get(this)); + a.lazySet(this,two); + assertEquals(two,a.get(this)); + a.lazySet(this,m3); + assertEquals(m3,a.get(this)); + } + /** * compareAndSet succeeds in changing value if equal to expected else fails */