On Thu, 8 May 2025 14:28:18 GMT, kabutz <d...@openjdk.org> wrote:

>> src/java.base/share/classes/java/util/concurrent/LinkedBlockingDeque.java 
>> line 865:
>> 
>>> 863:         long n = 0;
>>> 864:         for (E e : c) {
>>> 865:             Objects.requireNonNull(e);
>> 
>> This makes me wonder: Does it make sense to create new nodes if we don't 
>> track if they will still fit into the capacity?
>
> We could if you like, but that would subtly change the current behaviour. I 
> tried to make as few changes as possible.

On the other hand, there could be intermediate operations modifying the 
underlying collection before the lock is obtained, so checking wouldn't help.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24925#discussion_r2081840954

Reply via email to