[concurrency-interest] Java Memory Model and ParallelStream

Doug Lea dl at cs.oswego.edu
Fri Mar 6 07:22:18 EST 2020


Just to emphasize Alexey's main point...

On 3/6/20 6:44 AM, Aleksey Shipilev via Concurrency-interest wrote:

> Otherwise, look, high-level guarantees are the king.
> 
> It is not really relevant how that detection/acquisition happens:
>  - successful Thread.join() for a terminating worker; (guaranteed by JLS)
>  - successful Future.get() from executor; (guaranteed by package spec in java.util.concurrent.*)
>  - successful forEach for a parallel stream; (provided by extension?)

(See also the java.util.stream package docs. Current version at:
https://docs.oracle.com/en/java/javase/13/docs/api/java.base/java/util/stream/package-summary.html

In other words, java.util.concurrent components make strong enough
guarantees that almost nobody ever needs to think about them. On the
other hand, they so often invisibly do what people expect that is too
easy for some to imagine other nonexistent rules are responsible.

-Doug



More information about the Concurrency-interest mailing list