[concurrency-interest] BlockingQueue.drainTo

David Holmes dholmes@dltech.com.au
Tue, 7 Dec 2004 07:35:49 +1000


Jean Morissette wrote:
> Could you tell me why method drainTo is in BlockingQueue instead of Queue?

drainTo provides the capability for a "bulk poll" operation which is only
needed in a concurrently accessed queue. Queue is not specified for
concurrent use while BlockingQueue is.

It would be possible to have a concurrent implementation of Queue that
chooses not to also be a BlockingQueue, and which might also want a drainTo
method.

David Holmes