[concurrency-interest] ArrayBlockingQueue: concurrent put and take

Martin Buchholz martinrb at google.com
Thu Jul 3 13:34:04 EDT 2014


On Thu, Jul 3, 2014 at 2:35 AM, √iktor Ҡlang <viktor.klang at gmail.com> wrote:

> I think it was a mistake to have the BlockingQueue interface too broad. (A
> general issue with the JDK collections)
>

It was certainly very natural to have BlockingQueue extend Collection.  And
then it was natural to try to properly implement all the Collection methods
if it was not too onerous.  An alternative would have been to throw UOE on
"interior" methods like remove(Object).  In the case of ArrayBlockingQueue,
we eventually succeeded in implementing all the Collection methods without
performance penalty to ordinary intended usage, but there is definitely
implementation complexity penalty.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20140703/8cc2540f/attachment.html>


More information about the Concurrency-interest mailing list