Class ConcurrentPackedLongArray
- All Implemented Interfaces:
Serializable,Iterable<Long>
- Direct Known Subclasses:
PackedArrayRecorder.InternalConcurrentPackedLongArray
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:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.HdrHistogram.packedarray.AbstractPackedLongArray
AbstractPackedLongArray.AllValuesIterator -
Field Summary
FieldsFields inherited from class org.HdrHistogram.packedarray.AbstractPackedLongArray
NUMBER_OF_NON_ZEROS_TO_HASH -
Constructor Summary
ConstructorsConstructorDescriptionConcurrentPackedLongArray(int virtualLength) ConcurrentPackedLongArray(int virtualLength, int initialPhysicalLength) -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clear the array contents(package private) voidcopy()Create a copy of this array, complete with data and everything.(package private) long(package private) voidcriticalSectionExit(long criticalValueAtEnter) private void(package private) voidresizeStorageArray(int newPhysicalLengthInLongs) voidsetVirtualLength(int newVirtualArrayLength) Set a new virtual length for the array.toString()Methods inherited from class org.HdrHistogram.packedarray.AbstractPackedLongArray
add, add, equals, get, getArrayContext, getEndTimeStamp, getPhysicalLength, getStartTimeStamp, hashCode, increment, iterator, length, nonZeroValues, set, setArrayContext, setEndTimeStamp, setStartTimeStampMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
wrp
-
-
Constructor Details
-
ConcurrentPackedLongArray
public ConcurrentPackedLongArray(int virtualLength) -
ConcurrentPackedLongArray
public ConcurrentPackedLongArray(int virtualLength, int initialPhysicalLength)
-
-
Method Details
-
resizeStorageArray
void resizeStorageArray(int newPhysicalLengthInLongs) - Overrides:
resizeStorageArrayin classPackedLongArray
-
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.
-
clearContents
void clearContents()- Overrides:
clearContentsin classPackedLongArray
-
criticalSectionEnter
long criticalSectionEnter()- Overrides:
criticalSectionEnterin classPackedLongArray
-
criticalSectionExit
void criticalSectionExit(long criticalValueAtEnter) - Overrides:
criticalSectionExitin classPackedLongArray
-
toString
- Overrides:
toStringin classAbstractPackedLongArray
-
clear
public void clear()Description copied from class:AbstractPackedLongArrayClear the array contents- Overrides:
clearin classAbstractPackedLongArray
-
readObject
- Throws:
IOExceptionClassNotFoundException
-