[concurrency-interest] Method on LinkedBlockingQueue throws IllegalStateException

Joe Bowbeer joe.bowbeer at gmail.com
Tue Apr 17 20:12:54 EDT 2007

On 4/17/07, Szabolcs Ferenczi <szabolcs.ferenczi at gmail.com> wrote:
> I am talking about the inappropriate `add' and `remove' methods, which
> throw exceptions when the operation cannot be carried out on the shared
> data structure at the moment.

These are Collection methods.  BlockingQueue is designed so that it
can also be treated as an unshared collection.

> I must ask again: Why do you think it is a good idea to throw an
> exception if you are going to add a piece of data to a shared data
> structure but there is no room for it at the very moment?

It's a good idea when a shared data structure is not being shared, as
is sometimes the case, such as during startup and shutdown, or when
the threads have been paused.

This is my final response on this topic, by the way.

Joe Bowbeer

More information about the Concurrency-interest mailing list