[concurrency-interest] SynchronousQueue to use a LIFO for waitingTakes?

Doug Lea dl@cs.oswego.edu
Tue, 3 Feb 2004 10:44:13 -0500

Hi Guillaume,

(First, sorry about not yet replying to your related mail on this a
while ago.)

Using LIFO taker-queuing inside SynchronousQueue is indeed usually a
good idea (and probably even the best default choice) when used for
work queues. But in most other applications of SynchronousQueues, it
is usually a bad idea.

The logistic problem here is that unlike dl.util.concurrent, we can't
leave the insides of the j.u.c.SynchronousQueue class open enough for
people to make simple subclasses etc to get this effect. Which means
that the only reasonable alternative is to make LIFO/FIFO selectable
in a new SynchronousQueue constructor. This has the effect of any
restricting future re-implementations to also support this, which
might be a small enough price to pay. We'll think it over. If we can
do it this way, it might be possible to get this in to Tiger, since
the API change would just be an added constructor.