[concurrency-interest] PriorityBlockingQueue uses a fair lock

David Holmes davidcholmes at aapt.net.au
Wed May 5 20:14:37 EDT 2010


Hi Martin,

> A colleague noticed that PriorityBlockingQueue's
> internal lock is a fair ReentrantLock,
> when a non-fair lock would be much faster
> and usually "fair" enough.  Is there some history here?

Yes but even when it was discussed by the EG on January 11 2006 the history
had been lost somewhat.

> Should we add a non-fair option for constructing PBQ?

Yes. This addition was deemed too-late for Java 6 inclusion, but should have
been listed for Java 7.

Cheers,
David

> Martin
> _______________________________________________
> Concurrency-interest mailing list
> Concurrency-interest at cs.oswego.edu
> http://cs.oswego.edu/mailman/listinfo/concurrency-interest



More information about the Concurrency-interest mailing list