Methods Summary |
---|
public int | addAndGet(T obj, int delta)Atomically add the given value to current value.
for (;;) {
int current = get(obj);
int next = current + delta;
if (compareAndSet(obj, current, next))
return next;
}
|
public abstract boolean | compareAndSet(T obj, int expect, int update)Atomically set the value of the field of the given object managed
by this Updater to the given updated value if the current value
== the expected value. This method is guaranteed to be
atomic with respect to other calls to compareAndSet and
set, but not necessarily with respect to other
changes in the field.
|
public int | decrementAndGet(T obj)Atomically decrement by one the current value.
for (;;) {
int current = get(obj);
int next = current - 1;
if (compareAndSet(obj, current, next))
return next;
}
|
public abstract int | get(T obj)Get the current value held in the field by the given object.
|
public int | getAndAdd(T obj, int delta)Atomically add the given value to current value.
for (;;) {
int current = get(obj);
int next = current + delta;
if (compareAndSet(obj, current, next))
return current;
}
|
public int | getAndDecrement(T obj)Atomically decrement by one the current value.
for (;;) {
int current = get(obj);
int next = current - 1;
if (compareAndSet(obj, current, next))
return current;
}
|
public int | getAndIncrement(T obj)Atomically increment by one the current value.
for (;;) {
int current = get(obj);
int next = current + 1;
if (compareAndSet(obj, current, next))
return current;
}
|
public int | getAndSet(T obj, int newValue)Set to the given value and return the old value.
for (;;) {
int current = get(obj);
if (compareAndSet(obj, current, newValue))
return current;
}
|
public int | incrementAndGet(T obj)Atomically increment by one the current value.
for (;;) {
int current = get(obj);
int next = current + 1;
if (compareAndSet(obj, current, next))
return next;
}
|
public static java.util.concurrent.atomic.AtomicIntegerFieldUpdater | newUpdater(java.lang.Class tclass, java.lang.String fieldName)Creates an updater for objects with the given field. The Class
argument is needed to check that reflective types and generic
types match.
return new AtomicIntegerFieldUpdaterImpl<U>(tclass, fieldName);
|
public abstract void | set(T obj, int newValue)Set the field of the given object managed by this updater. This
operation is guaranteed to act as a volatile store with respect
to subsequent invocations of compareAndSet.
|
public abstract boolean | weakCompareAndSet(T obj, int expect, int update)Atomically set the value of the field of the given object managed
by this Updater to the given updated value if the current value
== the expected value. This method is guaranteed to be
atomic with respect to other calls to compareAndSet and
set, but not necessarily with respect to other
changes in the field, and may fail spuriously.
|