Code Review 7107516: LinkedBlockingQueue/Deque.drainTo(Collection, int) returns 'maxElements' if its value is negative
chris.hegarty at oracle.com
Wed Nov 9 14:55:10 UTC 2011
According to the specification for BlockingQueue.drainTo(Collection c,
int maxElements), this method should return "the number of elements
transferred". However the implementation of this method for
LinkedBlockingQueue and LinkedBlockingDeque when given a negative number
returns the given negative number.
Invoking drainTo(Collection, int) with a value of 0 or less should
simply return 0.
This change has been pulled from Doug Lea's CVS and I have already
reviewed it. Sending to the list for further scrutiny/review.
More information about the core-libs-dev