It should allow to implement batching draining strategies using a mix of blocking peek + drain
eg
// ...
do {
while (q.blockingPeek(timeOut, unit) != null) {
// same while using poll too
if (q.drain(batch::offer, limit) > 0) {
processBatch(batch);
}
}
// perform timed check on something
} while (true); // or whatever other way to end this madness :P
Doing the same with the current API means using take or poll ie adding the just read e to the batch before using drain again, that's less "nice" (just a matter of taste, I know) and more verbose
It should allow to implement batching draining strategies using a mix of blocking peek + drain
eg
Doing the same with the current API means using
takeorpollie adding the just readeto the batch before usingdrainagain, that's less "nice" (just a matter of taste, I know) and more verbose