Class ConcurrentPackedLongArray
- All Implemented Interfaces:
Serializable,Iterable<Long>
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.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConcurrentPackedLongArray(int virtualLength) ConcurrentPackedLongArray(int virtualLength, int initialPhysicalLength) -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clear the array contentscopy()Create a copy of this array, complete with data and everything.voidsetVirtualLength(int newVirtualArrayLength) Set a new virtual length for the array.toString()Methods inherited from class org.HdrHistogram.packedarray.AbstractPackedLongArray
add, add, equals, get, getEndTimeStamp, getPhysicalLength, getStartTimeStamp, hashCode, increment, iterator, length, nonZeroValues, set, setEndTimeStamp, setStartTimeStampMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
ConcurrentPackedLongArray
public ConcurrentPackedLongArray(int virtualLength) -
ConcurrentPackedLongArray
public ConcurrentPackedLongArray(int virtualLength, int initialPhysicalLength)
-
-
Method Details
-
setVirtualLength
public void setVirtualLength(int newVirtualArrayLength) Description copied from class:AbstractPackedLongArraySet a new virtual length for the array.- Overrides:
setVirtualLengthin classPackedLongArray- Parameters:
newVirtualArrayLength- the
-
copy
Description copied from class:AbstractPackedLongArrayCreate a copy of this array, complete with data and everything.- Overrides:
copyin classPackedLongArray- Returns:
- A distinct copy of this array.
-
toString
- Overrides:
toStringin classAbstractPackedLongArray
-
clear
public void clear()Description copied from class:AbstractPackedLongArrayClear the array contents- Overrides:
clearin classAbstractPackedLongArray
-