public class AtomicFieldUpdater<ContainingClass,FieldType>
extends java.lang.Object
AtomicReferenceFieldUpdater
except:
- removed access check in getAndSet() hot path for performance
- new methods "forFieldXXX" added that search by field type instead of field name, which is useful in scrambled classesModifier and Type | Method and Description |
---|---|
boolean |
compareAndSet(ContainingClass owner,
FieldType expected,
FieldType newValue) |
boolean |
compareAndSetInt(ContainingClass owner,
int expected,
int newValue) |
boolean |
compareAndSetLong(ContainingClass owner,
long expected,
long newValue) |
static <O,E> AtomicFieldUpdater<O,E> |
forField(java.lang.reflect.Field field) |
static <T,V> AtomicFieldUpdater<T,V> |
forFieldOfType(java.lang.Class<T> ownerClass,
java.lang.Class<V> fieldType) |
static <T> AtomicFieldUpdater<T,java.lang.Integer> |
forIntFieldIn(java.lang.Class<T> ownerClass) |
static <T> AtomicFieldUpdater<T,java.lang.Long> |
forLongFieldIn(java.lang.Class<T> ownerClass) |
FieldType |
get(ContainingClass owner) |
static sun.misc.Unsafe |
getUnsafe() |
void |
set(ContainingClass owner,
FieldType newValue) |
public static sun.misc.Unsafe getUnsafe()
public static <T,V> AtomicFieldUpdater<T,V> forFieldOfType(java.lang.Class<T> ownerClass, java.lang.Class<V> fieldType)
public static <T> AtomicFieldUpdater<T,java.lang.Long> forLongFieldIn(java.lang.Class<T> ownerClass)
public static <T> AtomicFieldUpdater<T,java.lang.Integer> forIntFieldIn(java.lang.Class<T> ownerClass)
public static <O,E> AtomicFieldUpdater<O,E> forField(java.lang.reflect.Field field)
public boolean compareAndSet(ContainingClass owner, FieldType expected, FieldType newValue)
public boolean compareAndSetLong(ContainingClass owner, long expected, long newValue)
public boolean compareAndSetInt(ContainingClass owner, int expected, int newValue)
public void set(ContainingClass owner, FieldType newValue)
public FieldType get(ContainingClass owner)