public class ConcurrentPackedLongArray extends PackedLongArray
get(), set(), add() and
increment() operations the logical contents of the array.
ConcurrentPackedLongArray supports concurrent accumulation, with the add() and increment() methods providing lossless atomic accumulation in the presence of multiple writers. However, it is
important to note that add() and increment() are the *only* safe concurrent
operations, and that all other operations, including get(), set() and clear() may
produce "surprising" results if used on an array that is not at rest.
While the add() and increment() methods are not quite wait-free, they come "close"
that behavior in the sense that a given thread will incur a total of no more than a capped fixed number (e.g. 74 in a
current implementation) of non-wait-free add or increment operations during the lifetime of an array, regardless of
the number of operations done.
| Constructor and Description |
|---|
ConcurrentPackedLongArray(int virtualLength) |
ConcurrentPackedLongArray(int virtualLength,
int initialPhysicalLength) |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clear the array contents
|
ConcurrentPackedLongArray |
copy()
Create a copy of this array, complete with data and everything.
|
void |
setVirtualLength(int newVirtualArrayLength)
Set a new virtual length for the array.
|
String |
toString() |
add, add, equals, get, getEndTimeStamp, getPhysicalLength, getStartTimeStamp, hashCode, increment, iterator, length, nonZeroValues, set, setEndTimeStamp, setStartTimeStampclone, finalize, getClass, notify, notifyAll, wait, wait, waitforEach, spliteratorpublic ConcurrentPackedLongArray(int virtualLength)
public ConcurrentPackedLongArray(int virtualLength,
int initialPhysicalLength)
public void setVirtualLength(int newVirtualArrayLength)
AbstractPackedLongArraysetVirtualLength in class PackedLongArraynewVirtualArrayLength - thepublic ConcurrentPackedLongArray copy()
AbstractPackedLongArraycopy in class PackedLongArraypublic String toString()
toString in class AbstractPackedLongArraypublic void clear()
AbstractPackedLongArrayclear in class AbstractPackedLongArrayCopyright © 2025. All rights reserved.