[concurrency-interest] Method on LinkedBlockingQueue throwsIllegalStateException

Szabolcs Ferenczi szabolcs.ferenczi at gmail.com
Tue Apr 17 19:21:59 EDT 2007

On 18/04/07, David Holmes <dcholmes at optusnet.com.au> wrote:
> The inherited methods from Collection et al were not intended for
> multi-threaded use. Hence the BlockingQueue interface was defined to provide
> the desirable semantics for multi-threaded use. It was considered very
> important that concurrent collections also support the legacy Collection
> methods.
> If want blocking behaviour when encountering full/empty conditions then use
> the methods from BlockingQueue in place of similar methods from Collection.

Hm. I was not aware that it is already intentional programming.

Nevertheless, the interface Blocking Queue equally well defines the
dangerous add method that throws an IllegalStateException. See:


Why do you think a BlockingQueue must have an interface like this? The
problem is there. "I suggest you go and read a lot of literature on
the subject to understand"  that concurrent programming is not a joke.
Defining a method for a blocking queue that throws an exception if the
queue is full more than a mistake, I can tell you.

Best Regards,

More information about the Concurrency-interest mailing list