Java Code Examples for java.util.concurrent.atomic.AtomicReference.lazySet()

The following are Jave code examples for showing how to use lazySet() of the java.util.concurrent.atomic.AtomicReference class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: openjdk-jdk10   File: AtomicReferenceTest.java   Source Code and License Vote up 5 votes
/**
 * get returns the last value lazySet in same thread
 */
public void testGetLazySet() {
    AtomicReference ai = new AtomicReference(one);
    assertSame(one, ai.get());
    ai.lazySet(two);
    assertSame(two, ai.get());
    ai.lazySet(m3);
    assertSame(m3, ai.get());
}