[concurrency-interest] ForkJoinPool not designed for nested Java 8 streams.parallel().forEach( ... )

Doug Lea dl at cs.oswego.edu
Mon May 5 19:09:20 EDT 2014

On 05/05/2014 03:58 PM, Christian Fries wrote:
> I am new to this list, so please excuse, if this is not the place for the
> following topic (I did a bug report to Oracle and also posted this to
> Stackoverflow at http://stackoverflow.com/questions/23442183 - and it was
> suggested (at SO) that I post this here too).

Sorry that you and a bunch of people at stackOverflow spent so much time
on this because you did not did not notice the java.util.stream documentation
about the use of independent functions/actions (especially not those including
synchronization). We should do something about this.

Thanks to David and Aleksey for explaining that the problem has nothing
to do with nested parallelism (except that in this case it triggered a
problem that otherwise happened not to occur).

I'm wondering if we should retrofit ManagedBlocker mechanics to all
j.u.c blocking synchronizers to avoid future problem reports. The
results of using streams/FJ in such cases will not always be very
sensible, but at least they won't starve. This would cover pretty
much all possibly user synchronization except for manual wait/notify
monitor constructions.

(And if we did this for IO as well, we'd have an implicit answer to
Joel Richards's queries...)


More information about the Concurrency-interest mailing list