/** get returns the last value lazySet in same thread */
 public void testGetLazySet() {
   AtomicInteger ai = new AtomicInteger(1);
   assertEquals(1, ai.get());
   ai.lazySet(2);
   assertEquals(2, ai.get());
   ai.lazySet(-3);
   assertEquals(-3, ai.get());
 }
Example #2
0
 /** 1. 最后设置为给定的值。 */
 public void testLazySet() {
   AtomicInteger ai = new AtomicInteger();
   ai.lazySet(10);
   System.out.println(ai); // 10
 }