On Thu, 17 Sep 2026 16:52:31 GMT, Viktor Klang <[email protected]> wrote:

>> Fabian Meumertzheim has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   Add comments
>
> 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.

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

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

Reply via email to