Java in a Nutshell, 5th Edition [Electronic resources]

نسخه متنی -صفحه : 1191/ 810
نمايش فراداده

AtomicBooleanjava.util.concurrent.atomic

Java 5.0serializable

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.AtomicBoolean

public 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 ( ); }