Team LiB
Previous Section Next Section

AtomicReferenceArray<E>java.util.concurrent.atomic

Java 5.0serializable

This threadsafe class holds an array of elements of type E. It provides volatile access semantics for these array elements and defines atomic operations for manipulating them. Its methods are like those of AtomicReference with the addition of a parameter that specifies the array index of the desired element.

Figure 16-103. java.util.concurrent.atomic.AtomicReferenceArray<E>


public class AtomicReferenceArray<E> implements Serializable {
// Public Constructors
     public AtomicReferenceArray(E[ ] array);  
     public AtomicReferenceArray(int length);  
// Public Instance Methods
     public final boolean compareAndSet(int i, E expect, E update);  
     public final E get(int i);  
     public final E getAndSet(int i, E newValue);  
     public final int length( );  
     public final void set(int i, E newValue);  
     public final boolean weakCompareAndSet(int i, E expect, E update);  
// Public Methods Overriding Object
     public String toString( );  
}

    Team LiB
    Previous Section Next Section