Name
AtomicReferenceArray<E>
Synopsis
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( ); }
Get Java in a Nutshell, 5th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.