Home » openjdk-7 » java » util » concurrent » atomic » [javadoc | source]
java.util.concurrent.atomic
public class: AtomicBoolean [javadoc | source]
java.lang.Object
   java.util.concurrent.atomic.AtomicBoolean

All Implemented Interfaces:
    java$io$Serializable

A {@code boolean} value that may be updated atomically. See the java.util.concurrent.atomic package specification for description of the properties of atomic variables. An {@code AtomicBoolean} is used in applications such as atomically updated flags, and cannot be used as a replacement for a java.lang.Boolean .
Constructor:
 public AtomicBoolean() 
 public AtomicBoolean(boolean initialValue) 
Method from java.util.concurrent.atomic.AtomicBoolean Summary:
compareAndSet,   get,   getAndSet,   lazySet,   set,   toString,   weakCompareAndSet
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from java.util.concurrent.atomic.AtomicBoolean Detail:
 public final boolean compareAndSet(boolean expect,
    boolean update) 
    Atomically sets the value to the given updated value if the current value {@code ==} the expected value.
 public final boolean get() 
    Returns the current value.
 public final boolean getAndSet(boolean newValue) 
    Atomically sets to the given value and returns the previous value.
 public final  void lazySet(boolean newValue) 
    Eventually sets to the given value.
 public final  void set(boolean newValue) 
    Unconditionally sets to the given value.
 public String toString() 
    Returns the String representation of the current value.
 public boolean weakCompareAndSet(boolean expect,
    boolean update) 
    Atomically sets the value to the given updated value if the current value {@code ==} the expected value.

    May fail spuriously and does not provide ordering guarantees, so is only rarely an appropriate alternative to {@code compareAndSet}.