This threadsafe class holds a boolean value. In addition to the get( ) and set( ) iterators, it provides atomic compareAndSet( ) , weakCompareAndSet( ) , and getAndSet( ) operations. Figure 16-97. java.util.concurrent.atomic.AtomicBooleanpublic class AtomicBoolean implements Serializable { // Public Constructors public AtomicBoolean ( ); public AtomicBoolean (boolean initialValue ); // Public Instance Methods public final boolean compareAndSet (boolean expect , boolean update ); public final boolean get ( ); public final boolean getAndSet (boolean newValue ); public final void set (boolean newValue ); public boolean weakCompareAndSet (boolean expect , boolean update ); // Public Methods Overriding Object public String toString ( ); } |