Coupling in ExtentLocal

Alan Bateman Alan.Bateman at oracle.com
Fri Aug 5 11:21:23 UTC 2022


On 04/08/2022 20:35, Holo The Sage Wolf wrote:
> ||
>
> Some implementations of |Collection| that will always fail, some will 
> always succeed, and some implementations (like |HashSet|) may be 
> non-deterministic.
> For the uninformed this method makes sense, for each 
> |PartitiableAction| I create some kind of a new “|Executor|“ that 
> everyone is talking about, if one of the parts fails, the whole 
> calculation of this specific |PartitiableAction| will stop running, 
> and I am waiting for everything to end.
>

You may be right that someone may choose to ignore the javadoc, the 
examples, and the recommendation to use try-with-resources but that 
isn't a slam dunk argument for changing that API to use lambda 
expressions and all the usability issues that it would bring.  The 
example is a bit strange, it seems to assume that any action can process 
any input. Also the iteration order of "actions" can be deterministic 
and it will still fail because it will attempt to close the scopes in 
iteration order when it should be closing them in reverse iteration 
order. So you should see an exception at runtime if actions contains 
more than one element.

In any case, I think this is just another reminder that having language 
support that would somehow enforce the use of try-with-resources would 
be very helpful here.

-Alan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/core-libs-dev/attachments/20220805/a5cb372e/attachment-0001.htm>


More information about the core-libs-dev mailing list