Class ConcurrentPackedLongArray
- java.lang.Object
-
- org.HdrHistogram.packedarray.AbstractPackedLongArray
-
- org.HdrHistogram.packedarray.PackedLongArray
-
- org.HdrHistogram.packedarray.ConcurrentPackedLongArray
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Iterable<java.lang.Long>
- Direct Known Subclasses:
PackedArrayRecorder.InternalConcurrentPackedLongArray
public class ConcurrentPackedLongArray extends PackedLongArray
A Packed array of signed 64 bit values that supportsget(),set(),add()andincrement()operations the logical contents of the array.ConcurrentPackedLongArraysupports concurrent accumulation, with theadd()andincrement()methods providing lossless atomic accumulation in the presence of multiple writers. However, it is impotant to note thatadd()andincrement()are the *only* safe concurrent operations, and that all other operations, includingget(),set()andclear()may produce "suprising" results if used on an array that is not at rest. While theadd()andincrement()methods are not quite wait-free, they come "close" that behvaior 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, regradless of the number of operations done.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.HdrHistogram.packedarray.AbstractPackedLongArray
AbstractPackedLongArray.AllValuesIterator
-
-
Field Summary
Fields Modifier and Type Field Description (package private) WriterReaderPhaserwrp-
Fields inherited from class org.HdrHistogram.packedarray.AbstractPackedLongArray
NUMBER_OF_NON_ZEROS_TO_HASH
-
-
Constructor Summary
Constructors Constructor Description ConcurrentPackedLongArray(int virtualLength)ConcurrentPackedLongArray(int virtualLength, int initialPhysicalLength)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clear the array contents(package private) voidclearContents()ConcurrentPackedLongArraycopy()Create a copy of this array, complete with data and everything.(package private) longcriticalSectionEnter()(package private) voidcriticalSectionExit(long criticalValueAtEnter)private voidreadObject(java.io.ObjectInputStream o)(package private) voidresizeStorageArray(int newPhysicalLengthInLongs)voidsetVirtualLength(int newVirtualArrayLength)Set a new virtual length for the array.java.lang.StringtoString()-
Methods inherited from class org.HdrHistogram.packedarray.AbstractPackedLongArray
add, add, equals, get, getArrayContext, getEndTimeStamp, getPhysicalLength, getStartTimeStamp, hashCode, increment, iterator, length, nonZeroValues, set, setArrayContext, setEndTimeStamp, setStartTimeStamp
-
-
-
-
Field Detail
-
wrp
transient WriterReaderPhaser wrp
-
-
Method Detail
-
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
public ConcurrentPackedLongArray 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
public java.lang.String toString()
- Overrides:
toStringin classAbstractPackedLongArray
-
clear
public void clear()
Description copied from class:AbstractPackedLongArrayClear the array contents- Overrides:
clearin classAbstractPackedLongArray
-
readObject
private void readObject(java.io.ObjectInputStream o) throws java.io.IOException, java.lang.ClassNotFoundException- Throws:
java.io.IOExceptionjava.lang.ClassNotFoundException
-
-