Package org.jboss.util.collection
Class ConcurrentSkipListMap.Index<K,V>
- java.lang.Object
-
- org.jboss.util.collection.ConcurrentSkipListMap.Index<K,V>
-
- Direct Known Subclasses:
ConcurrentSkipListMap.HeadIndex
- Enclosing class:
- ConcurrentSkipListMap<K,V>
static class ConcurrentSkipListMap.Index<K,V> extends java.lang.Object
Index nodes represent the levels of the skip list. To improve search performance, keys of the underlying nodes are cached. Note that even though both Nodes and Indexes have forward-pointing fields, they have different types and are handled in different ways, that can't nicely be captured by placing field in a shared abstract class.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) ConcurrentSkipListMap.Index<K,V>
down
(package private) K
key
(package private) ConcurrentSkipListMap.Node<K,V>
node
(package private) ConcurrentSkipListMap.Index<K,V>
right
(package private) static java.util.concurrent.atomic.AtomicReferenceFieldUpdater<ConcurrentSkipListMap.Index,ConcurrentSkipListMap.Index>
rightUpdater
Updater for casRight
-
Constructor Summary
Constructors Constructor Description Index(ConcurrentSkipListMap.Node<K,V> node, ConcurrentSkipListMap.Index<K,V> down, ConcurrentSkipListMap.Index<K,V> right)
Creates index node with given values
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) boolean
casRight(ConcurrentSkipListMap.Index<K,V> cmp, ConcurrentSkipListMap.Index<K,V> val)
compareAndSet right field(package private) boolean
indexesDeletedNode()
Returns true if the node this indexes has been deleted.(package private) boolean
link(ConcurrentSkipListMap.Index<K,V> succ, ConcurrentSkipListMap.Index<K,V> newSucc)
Tries to CAS newSucc as successor.(package private) boolean
unlink(ConcurrentSkipListMap.Index<K,V> succ)
Tries to CAS right field to skip over apparent successor succ.
-
-
-
Field Detail
-
key
final K key
-
node
final ConcurrentSkipListMap.Node<K,V> node
-
down
final ConcurrentSkipListMap.Index<K,V> down
-
right
volatile ConcurrentSkipListMap.Index<K,V> right
-
rightUpdater
static final java.util.concurrent.atomic.AtomicReferenceFieldUpdater<ConcurrentSkipListMap.Index,ConcurrentSkipListMap.Index> rightUpdater
Updater for casRight
-
-
Constructor Detail
-
Index
Index(ConcurrentSkipListMap.Node<K,V> node, ConcurrentSkipListMap.Index<K,V> down, ConcurrentSkipListMap.Index<K,V> right)
Creates index node with given values
-
-
Method Detail
-
casRight
final boolean casRight(ConcurrentSkipListMap.Index<K,V> cmp, ConcurrentSkipListMap.Index<K,V> val)
compareAndSet right field
-
indexesDeletedNode
final boolean indexesDeletedNode()
Returns true if the node this indexes has been deleted.- Returns:
- true if indexed node is known to be deleted
-
link
final boolean link(ConcurrentSkipListMap.Index<K,V> succ, ConcurrentSkipListMap.Index<K,V> newSucc)
Tries to CAS newSucc as successor. To minimize races with unlink that may lose this index node, if the node being indexed is known to be deleted, it doesn't try to link in.- Parameters:
succ
- the expected current successornewSucc
- the new successor- Returns:
- true if successful
-
unlink
final boolean unlink(ConcurrentSkipListMap.Index<K,V> succ)
Tries to CAS right field to skip over apparent successor succ. Fails (forcing a retraversal by caller) if this node is known to be deleted.- Parameters:
succ
- the expected current successor- Returns:
- true if successful
-
-