org.zilonis.util.concurrent
Class Node<E>
java.lang.Object
java.util.concurrent.atomic.AtomicReference<Node<E>>
org.zilonis.util.concurrent.Node<E>
- All Implemented Interfaces:
- java.io.Serializable
public class Node<E>
- extends java.util.concurrent.atomic.AtomicReference<Node<E>>
Linked Nodes. As a minor efficiency hack, this class opportunistically
inherits from AtomicReference, with the atomic ref used as the "next"
link.
Nodes are in doubly-linked lists. There are three kinds of special nodes,
distinguished by: * The list header has a null prev link * The list
trailer has a null next link * A deletion marker has a prev link pointing
to itself. All three kinds of special nodes have null element fields.
Regular nodes have non-null element, next, and prev fields. To avoid
visible inconsistencies when deletions overlap element replacement,
replacements are done by replacing the node, not just setting the
element.
Nodes can be traversed by read-only ConcurrentLinkedDeque class
operations just by following raw next pointers, so long as they ignore
any special nodes seen along the way. (This is automated in method
forward.) However, traversal using prev pointers is not guaranteed to see
all live nodes since a prev pointer of a deleted node can become
unrecoverably stale.
- See Also:
- Serialized Form
| Methods inherited from class java.util.concurrent.atomic.AtomicReference |
compareAndSet, get, getAndSet, lazySet, set, toString, weakCompareAndSet |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |