|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.concurrent.atomic.AtomicLongArray
com.atlassian.util.concurrent.atomic.AtomicLongArray
public class AtomicLongArray
AtomicReferenceArray with richer functionality. This class implements
commonly implemented patterns of use of compareAndSet such as
#getAndSetIf(int, Object, Object)
and update(int, Function)
.
Constructor Summary | |
---|---|
AtomicLongArray(int length)
Creates a new AtomicLongArray of given length. |
|
AtomicLongArray(long[] initialValue)
Creates a new AtomicLongArray with the same length as, and all elements copied from, the given array. |
Method Summary | |
---|---|
long |
getOrSetAndGetIf(int index,
long oldValue,
long newValue)
Check the current value and if it matches the old value argument, set it to the new value and return that instead. |
long |
update(int index,
com.google.common.base.Function<java.lang.Long,java.lang.Long> newValueFactory)
Do the actual update. |
Methods inherited from class java.util.concurrent.atomic.AtomicLongArray |
---|
addAndGet, compareAndSet, decrementAndGet, get, getAndAdd, getAndDecrement, getAndIncrement, getAndSet, incrementAndGet, lazySet, length, set, toString, weakCompareAndSet |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public AtomicLongArray(int length)
length
- the length of the arraypublic AtomicLongArray(long[] initialValue)
array
- the array to copy elements from
java.lang.NullPointerException
- if array is nullMethod Detail |
---|
public final long getOrSetAndGetIf(int index, long oldValue, long newValue)
index
- the array indexoldValue
- to check the current value against (reference equality
check only)newValue
- the new value to set it to
public final long update(int index, com.google.common.base.Function<java.lang.Long,java.lang.Long> newValueFactory)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |