Class ConcurrentHashMapV8.Traverser<K,V>
java.lang.Object
org.glassfish.jersey.internal.util.collection.ConcurrentHashMapV8.Traverser<K,V>
- Direct Known Subclasses:
ConcurrentHashMapV8.BaseIterator
- Enclosing class:
ConcurrentHashMapV8<K,
V>
Encapsulates traversal for methods such as containsValue; also
serves as a base class for other iterators and spliterators.
Method advance visits once each still-valid node that was
reachable upon iterator construction. It might miss some that
were added to a bin after the bin was visited, which is OK wrt
consistency guarantees. Maintaining this property in the face
of possible ongoing resizes requires a fair amount of
bookkeeping state that is difficult to optimize away amidst
volatile accesses. Even so, traversal maintains reasonable
throughput.
Normally, iteration proceeds bin-by-bin traversing lists.
However, if the table has been resized, then all future steps
must traverse both the bin at the current index as well as at
(index + baseSize); and so on for further resizings. To
paranoically cope with potential sharing by users of iterators
across threads, iteration terminates if a bounds checks fails
for a table read.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTraverser
(ConcurrentHashMapV8.Node<K, V>[] tab, int size, int index, int limit) -
Method Summary
Modifier and TypeMethodDescription(package private) final ConcurrentHashMapV8.Node
<K, V> advance()
Advances if possible, returning next valid node, or null if none.
-
Field Details
-
tab
ConcurrentHashMapV8.Node<K,V>[] tab -
next
ConcurrentHashMapV8.Node<K,V> next -
index
int index -
baseIndex
int baseIndex -
baseLimit
int baseLimit -
baseSize
final int baseSize
-
-
Constructor Details
-
Traverser
Traverser(ConcurrentHashMapV8.Node<K, V>[] tab, int size, int index, int limit)
-
-
Method Details
-
advance
Advances if possible, returning next valid node, or null if none.
-