Code example for AtomicBoolean

0
 * </ul> 
 */ 
@ThreadSafe 
public class MemoryBarrier { 
 
    private final AtomicBoolean var = new AtomicBoolean();
 
    public void storeStore() { 
        var.lazySet(true);
    } 
 
    public void storeLoad() { 
        var.set(true);
    } 
 
    public void loadLoad() { 
        var.get();
    } 
}