Stream confusion

Ron Pressler ron.pressler at oracle.com
Wed Nov 22 19:50:03 UTC 2023



> On 22 Nov 2023, at 19:44, Mark Raynsford <org.openjdk at io7m.com> wrote:


> Nothing ensures those calls to Map.put() will result in safe publication.

The JMM does, and if virtual threads break it then that’s a bug.

What guides visibility in Java isn’t thread identity but the JMM and its happens-before relationship. It doesn’t matter which OS thread performs an operation. What matters is that the JMM’s happens-before relationships are preserved.

Anyway, I don’t think any of this discussion belongs on amber-dev (I should have pointed it out earlier). Discussions about streams and their JMM guarantees belong in core-libs-dev. Discussions about virtual threads belong on loom-dev.

— Ron



More information about the amber-dev mailing list