Code Review 7107516: LinkedBlockingQueue/Deque.drainTo(Collection, int) returns 'maxElements' if its value is negative
mike.duigou at oracle.com
Wed Nov 9 16:44:10 UTC 2011
The change looks good.
The creation of node instances could use diamond. ie.
Node<E> node = new Node<E>(e);
could be :
Node<E> node = new Node<>(e);
On Nov 9 2011, at 06:55 , Chris Hegarty wrote:
> 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