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.

Webrev:
  http://cr.openjdk.java.net/~chegar/7107516/webrev.00/webrev/

Thanks,
-Chris.

Reply via email to