Synchronous executor interface

Attila Kelemen attila.kelemen85 at gmail.com
Tue Aug 8 15:07:44 UTC 2023


robert engels <rengels at ix.netcom.com> ezt írta (időpont: 2023. aug. 8., K,
1:52):

> But why not? Future is pervasive - and then the user can easily switch
> between synchronous executors and async executors with no user code change
> - and 0 changes to the JDK.
>
>
Because Future does not convey the idea that it must be synchronous (in
fact, it hints otherwise), and doing something like this is dangerous for
async executors, because it is often hard to argue about the context you
are called in:

```
// ExecutorService executor
var result = executor
  .submit(() -> whatever_action)
  .get();
```
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/loom-dev/attachments/20230808/f9f357af/attachment-0001.htm>


More information about the loom-dev mailing list