On Fri, 18 Sep 2026 08:36:54 GMT, Fabian Meumertzheim <[email protected]> wrote:

>> src/java.base/share/classes/java/util/concurrent/ConcurrentSkipListMap.java 
>> line 2654:
>> 
>>> 2652:             }
>>> 2653:             Node<K,V> n = m.findNear(key, rel, cmp);
>>> 2654:             return (n == null || !inBounds(n.key, cmp)) ? null : 
>>> n.key;
>> 
>> @fmeum So this is now relying on the fact that `findNear` will not return 
>> nodes with null `val`s anymore?
>
> findNear may still return nodes with val == null, but the old version of 
> getNearKey may also have returned a key whose node had been removed between 
> the check and the return. In both versions it was necessary to verify that 
> the node is still live after its next link has been read. Now that this check 
> lives next to that read in findNear, it doesn't have to be redone here.

Ah, yes, sorry, I was focusing on the wrong thing. Thanks for setting the 
record straight

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/32793#discussion_r4045564236

Reply via email to