j.u.s.Stream and Fiber

Alan Bateman Alan.Bateman at oracle.com
Thu Sep 19 11:25:52 UTC 2019


On 18/09/2019 21:37, Arkadiusz Gasiński wrote:
> Hi,
>
> Sorry if this was asked already - looked through the mailing list, but
> couldn't find the answer... And the question is: Are JDK's j.u.s.Stream
> implementation classes Fiber-aware? For example if I trigger a terminal
> operation on a parallel stream in the context of a Fiber, would there
> possibly be new fibers scheduled to process the stream elements? If so,
> what will be the scope of these additional Fibers?
If there is parallel execution then it will use ForkJoinPool, no change. 
It's possible that the fiber executing the terminal operation may 
temporarily pin its carrier thread when joining (you might see it 
blocked in externalAwaitDone). I'm sure Doug or Martin will have ideas 
if it becomes an issue.

-Alan




More information about the loom-dev mailing list