Fri, 26 Sep 2003 19:43:32 -0400
> I was looking at the toArray() methods in LinkedBlockingQueue
I think you misinterpreted this method. It does not extract elements
into the array; it copies them (as do all other Collection.toArray
I think this accounts for your confusion about questions 1-2.
I gather that what you are looking for is a non-existent method
<T> T drain(T array)
void drain(Collection<E> c, int maxElements)
that drains (i.e., removes) up to maxElements elements into an array
or collection. (It would need to be non-blocking, poll-like rather
than take-like, or else multiple drain's could be starved out unless
there were uniform fairness guarantees across queues, which there
aren't. This is analogous to why FairSemaphore supports acquire(n),
but non-guaranteed-fair Semaphore does not.)
Could you give a compelling use case or two showing why you need
something like this? Can anyone else?
> 4. Javadoc corrections
> In all classes except Semaphore & Future its TimeUnit unit instead of
> TimeUnit granularity
Thanks! Yes, we should change these to be consistent.