[External] : Re: [POTENTIAL BUG] Potential FIFO violation in BlockingQueue under high contention and suggestion for fair mode in ArrayBlockingQueue and LinkedBlockingQueue
Daniel Fuchs
daniel.fuchs at oracle.com
Wed Sep 4 12:35:36 UTC 2024
Hi Kim,
On 04/09/2024 12:50, 김민주 wrote:
> In the original approach, I intended for each thread to call |put|,
> confirm that it has entered the waiting state, and then allow the next
> thread to put the next sequence value and also enter the waiting state.
> This approach was designed to simulate a situation where the queue is
> already full and each thread has to wait in line for space to become
> available.
The problem with that is that you would still need to ensure that each
thread calls `put` in order, and for that, you would still need
external synchronization.
I am not an expert in java.util.concurrent, but it feels like the
fix you had in mind would not buy you much.
best regards,
-- daniel
More information about the core-libs-dev
mailing list