A new build and a new structured concurrency API

Pedro Lamarão pedro.lamarao at prodist.com.br
Wed Nov 17 16:14:12 UTC 2021

Hello all,

Thanks for your hard work! Loom shows great promise!

I have made the experiment of writing an application immediately after
reading the documentation you linked.
The result is here: https://github.com/pedrolamarao/sandbox-loom-wget
I think there is great improvement in the most basic usability, even before
error propagation and cancellation.

In this exercise, I made an interesting mistake:
because I am used to initializing ThreadFactory from Thread:::new,
my first attempt to use virtual threads initialized ThreadFactory with
IDE code completion suggested it, probably because of the matching
signature, and I didn't think twice about it.
When the test failed with "thread already started" it took me a while to
figure out what was the problem.


Em seg., 15 de nov. de 2021 às 17:23, Ron Pressler <ron.pressler at oracle.com>

> Hi.
> We have just published a new Early Access build of Project Loom over on
> https://jdk.java.net/loom/
> The build is based on jdk-18+22, and now requires the --enable-preview
> flag to
> use Loom features (when compiling, remember to also add `--release 18`).
> The main new feature in this build is a new API for structured concurrency,
> called StructuredExecutor. To learn more about its motivation,
> capabilities,
> and use, please read this JEP draft [1] and the Javadoc [2]. Pay special
> attention to the new methods added to Future, resultNow and exceptionNow
> [3], and how they complement StructuredExecutor. One of the most exciting
> capabilities of StructuredExecutor is the new structured thread-dump
> mentioned
> in the JEP draft.
> Another new feature is the ability to use virtual threads as Cleaner
> threads
> [4]. We have also published a draft JEP for virtual threads [5]. The JEPs,
> like
> the project, are still a work in progress.
> As always, we appreciate feedback on these features from those who try
> them.
> Please, download the new EA and tell us about your experience.
> -- Ron
> [1]: http://openjdk.java.net/jeps/8277129
> [2]:
> https://download.java.net/java/early_access/loom/docs/api/java.base/java/util/concurrent/StructuredExecutor.html
> [3]:
> https://download.java.net/java/early_access/loom/docs/api/java.base/java/util/concurrent/Future.html
> [4]:
> https://download.java.net/java/early_access/loom/docs/api/java.base/java/lang/ref/Cleaner.html
> [5]: http://openjdk.java.net/jeps/8277131

Pedro Lamarão
Securing Critical Systems
Tel: +55 11 4380-6585

Antes de imprimir esta mensagem e seus anexos, certifique-se que seja
realmente necessário.
Proteger o meio ambiente é nosso dever.
Before printing this e-mail or attachments, be sure it is necessary.
It is in our hands to protect the environment.

More information about the loom-dev mailing list