![]() |
|
Contents |
long array in which elements may be updated atomically.
See the java.util.concurrent.atomic package specification for description of the properties of atomic variables.
Public Member Functions | |
| AtomicLongArray (int length) | |
| Create a new AtomicLongArray of given length. | |
| AtomicLongArray (long[] array) | |
| Create a new AtomicLongArray with the same length as, and all elements copied from, the given array. | |
| final int | length () |
| Returns the length of the array. | |
| final long | get (int i) |
Get the current value at position i. | |
| final void | set (int i, long newValue) |
Set the element at position i to the given value. | |
| final long | getAndSet (int i, long newValue) |
Set the element at position i to the given value and return the old value. | |
| final boolean | compareAndSet (int i, long expect, long update) |
Atomically set the value to the given updated value if the current value == the expected value. | |
| final boolean | weakCompareAndSet (int i, long expect, long update) |
Atomically set the value to the given updated value if the current value == the expected value. | |
| final long | getAndIncrement (int i) |
Atomically increment by one the element at index i. | |
| final long | getAndDecrement (int i) |
Atomically decrement by one the element at index i. | |
| final long | getAndAdd (int i, long delta) |
Atomically add the given value to element at index i. | |
| final long | incrementAndGet (int i) |
Atomically increment the element at index i. | |
| final long | decrementAndGet (int i) |
Atomically decrement the element at index i. | |
| long | addAndGet (int i, long delta) |
Atomically add the given value to element at index i. | |
| String | toString () |
| Returns the String representation of the current values of array. | |
Private Member Functions | |
| long | rawIndex (int i) |
Private Attributes | |
| final long[] | array |
Static Private Attributes | |
| static final long | serialVersionUID = -2308431214976778248L |
| static final Unsafe | unsafe = Unsafe.getUnsafe() |
| static final int | base = unsafe.arrayBaseOffset(long[].class) |
| static final int | scale = unsafe.arrayIndexScale(long[].class) |
| AtomicLongArray | ( | int | length | ) |
| AtomicLongArray | ( | long[] | array | ) |
Create a new AtomicLongArray with the same length as, and all elements copied from, the given array.
| array | the array to copy elements from |
| NullPointerException | if array is null |
| long rawIndex | ( | int | i | ) | [private] |
| final int length | ( | ) |
Returns the length of the array.
| final long get | ( | int | i | ) |
Get the current value at position i.
| i | the index |
| final void set | ( | int | i, | |
| long | newValue | |||
| ) |
Set the element at position i to the given value.
| i | the index | |
| newValue | the new value |
| final long getAndSet | ( | int | i, | |
| long | newValue | |||
| ) |
Set the element at position i to the given value and return the old value.
| i | the index | |
| newValue | the new value |
| final boolean compareAndSet | ( | int | i, | |
| long | expect, | |||
| long | update | |||
| ) |
Atomically set the value to the given updated value if the current value == the expected value.
| i | the index | |
| expect | the expected value | |
| update | the new value |
| final boolean weakCompareAndSet | ( | int | i, | |
| long | expect, | |||
| long | update | |||
| ) |
Atomically set the value to the given updated value if the current value == the expected value.
May fail spuriously.
| i | the index | |
| expect | the expected value | |
| update | the new value |
| final long getAndIncrement | ( | int | i | ) |
Atomically increment by one the element at index i.
| i | the index |
| final long getAndDecrement | ( | int | i | ) |
Atomically decrement by one the element at index i.
| i | the index |
| final long getAndAdd | ( | int | i, | |
| long | delta | |||
| ) |
Atomically add the given value to element at index i.
| i | the index | |
| delta | the value to add |
| final long incrementAndGet | ( | int | i | ) |
Atomically increment the element at index i.
| i | the index |
| final long decrementAndGet | ( | int | i | ) |
Atomically decrement the element at index i.
| i | the index |
| long addAndGet | ( | int | i, | |
| long | delta | |||
| ) |
Atomically add the given value to element at index i.
| i | the index | |
| delta | the value to add |
| String toString | ( | ) |
Returns the String representation of the current values of array.
final long serialVersionUID = -2308431214976778248L [static, private] |
final int base = unsafe.arrayBaseOffset(long[].class) [static, private] |
final int scale = unsafe.arrayIndexScale(long[].class) [static, private] |
final long [] array [private] |