io.netty.util.internal.chmv8.ForkJoinWorkerThread
Encapsulates traversal for methods such as containsValue; also serves as a base class for other iterators and bulk tasks. At each step, the iterator snapshots the key ("nextKey") and value ("nextVal") of a valid node (i.e., one that, at point of snapshot, has a non-null user value). Because val fields can change (including to null, indicating deletion), field nextVal might not be accurate at point of use, but still maintains the weak consistency property of holding a value that was once valid. To support iterator.remove, the nextKey field is not updated (nulled out) when the iterator cannot advance. Internal traversals directly access these fields, as in: {@code} while (it.advance() != null) process(it.nextKey); }} Exported iterators must track whether the iterator has advanced (in hasNext vs next) (by setting/checking/nulling field nextVal), and then extract key, value, or key-value pairs as return values of next(). The iterator 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. This class extends CountedCompleter to streamline parallel iteration in bulk operations. This adds only a few fields of space overhead, which is small enough in cases where it is not needed to not worry about it. Because CountedCompleter is Serializable, but iterators need not be, we need to add warning suppressions.