RFR: 8354060: LinkedBlockingDeque.clear() should preserve weakly-consistent iterators

kabutz duke at openjdk.org
Tue May 13 13:01:10 UTC 2025


On Mon, 7 Apr 2025 11:55:08 GMT, kabutz <duke at openjdk.org> wrote:

> LinkedBlockingDeque.clear() should preserve weakly-consistent iterators by linking f.prev and f.next back to f, allowing the iterators to continue from the first or last respectively. This would be consistent with how the other node-based weakly consistent queues LinkedBlockingQueue LinkedTransferQueue, ConcurrentLinkedQueue/Deque work.
> 
> The LBD already supports self-linking, since that is done by the unlinkFirst() and unlinkLast() methods, and the iterators and spliterator all support this.
> 
> This can be fixed very easily by linking both f.prev and f.next back to f.

These changes have been included in https://github.com/openjdk/jdk/pull/24925

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

PR Comment: https://git.openjdk.org/jdk/pull/24488#issuecomment-2876408558


More information about the core-libs-dev mailing list