Infinite parallel stream

Paul Sandoz paul.sandoz at oracle.com
Tue Apr 30 06:20:56 PDT 2013


On Apr 30, 2013, at 3:07 PM, Boaz Nahum <boaznahum at gmail.com> wrote:

> Thank so much
> 
> >2) !ORDERED
>  
>  infiniteStream.filter( .. reject 99.9% ... ).limit(100)
> 
> What is the global limit count in this case ?

100.

I meant "global" w.r.t. the F/J tasks of the limit operation.

Each time a F/J leaf task traverses an element it would decrement, safely, the global limit count. So when that count reaches zero (or traversal terminates normally) leaf tasks can complete, and further tasks, if any, to be created can be cancelled.

Paul.



More information about the lambda-dev mailing list