Package com.yahoo.concurrent
Class ThreadRobustList<T>
- java.lang.Object
-
- com.yahoo.concurrent.ThreadRobustList<T>
-
- All Implemented Interfaces:
java.lang.Iterable<T>
public class ThreadRobustList<T> extends java.lang.Object implements java.lang.Iterable<T>
A list which tolerates concurrent adds from one other thread while it is read. More precisely: This list is guaranteed to provide a self-consistent read view regardless of the internal order in which the primitive mutating operations on it are observed from the reading thread.This is useful for traced information as there may be timed out threads working on the structure after it is returned upwards for consumption.
- Since:
- 4.2
- Author:
- Steinar Knutsen, bratseth
-
-
Constructor Summary
Constructors Constructor Description ThreadRobustList()
ThreadRobustList(int initialCapacity)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(T item)
boolean
isEmpty()
java.util.Iterator<T>
iterator()
Returns an iterator over the elements of this.java.util.Iterator<T>
reverseIterator()
Returns an iterator over the elements of this, starting at the last element and working backwards.
-
-
-
Method Detail
-
add
public void add(T item)
-
iterator
public java.util.Iterator<T> iterator()
Returns an iterator over the elements of this. This iterator does not support remove.- Specified by:
iterator
in interfacejava.lang.Iterable<T>
-
reverseIterator
public java.util.Iterator<T> reverseIterator()
Returns an iterator over the elements of this, starting at the last element and working backwards. This iterator does not support remove.
-
isEmpty
public boolean isEmpty()
-
-