Class Accumulator<E>
java.lang.Object
org.apache.cassandra.utils.concurrent.Accumulator<E>
- Type Parameters:
E-
A simple append-only collection supporting an unbounded number of concurrent readers/writers,
but a bounded number of items.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Accumulator
public Accumulator(int size)
-
-
Method Details
-
add
Adds an item to the collection. Note it is not guaranteed to be visible on exiting the method, if another add was happening concurrently; it will be visible once all concurrent adds (which are non-blocking) complete, but it is not guaranteed that any size change occurs during the execution of any specific call.- Parameters:
item- add to collection
-
isEmpty
public boolean isEmpty() -
size
public int size()- Returns:
- the size of guaranteed-to-be-visible portion of the list
-
capacity
public int capacity() -
get
-
snapshot
-
clearUnsafe
public void clearUnsafe(int i) Removes element at the speficied index from this accumulator. This method is not thread-safe when used concurrently withadd(Object).
-