On Mon, 9 Jun 2025 09:24:57 GMT, Viktor Klang <vkl...@openjdk.org> wrote:
>>> We could likely check if there's any remaining capacity up front, and >>> immediately return false? >> >> We could if you like. I wanted to make as few changes as possible, to not >> introduce unexpected changes. This particular bug was to stop a size >> overflow. > > @DougLea What do you think about checking if the target collection is likely > going to fit into the queue early? Because of races, prechecks can't be exactly accurate, but I think Heinz's current approach is a good choice, and is similar to how it's done elsewhere. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/24925#discussion_r2135512775