<div dir="ltr"><div dir="ltr">On Wed, Nov 22, 2023 at 1:46 PM Ron Pressler <<a href="mailto:ron.pressler@oracle.com">ron.pressler@oracle.com</a>> wrote:</div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">For example, you can generally submit tasks with non-final fields to ExecutorServices backed by thread pools because the writes to the fields on the submitting thread “happen before” the submission, and the submission “happens before” the execution of the task on the worker thread.</blockquote><div><br></div><div>Thanks - I was missing that part. Although the docs don't use the "happens-before" terminology they do say this:</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>For well-behaved stream sources, the source can be modified before the
 terminal operation commences and those modifications will be reflected in
 the covered elements. <br></div></blockquote></div><div><br></div><div>So we would just need to know that our streams are "well behaved"... the docs say:<br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>All the
 streams returned from JDK collections, and most other JDK classes,
 are well-behaved in this manner; for streams generated by other libraries, see
 <a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/stream/package-summary.html#StreamSources">Low-level stream
 construction</a> for requirements for building well-behaved streams</div></blockquote><div><br></div><div>Hmm, that still leaves the door open for "poorly behaved" Streams. It would be nice if instead "well-behaved" were an explicit requirement.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>I don’t think any of this discussion belongs on amber-dev<br></div></blockquote><div><br></div><div>Sorry about that, I'll stop for now.<br></div><div><br></div><div>-Archie<br></div><br><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature">Archie L. Cobbs<br></div></div>