A new build and a new structured concurrency API

Alan Bateman Alan.Bateman at oracle.com
Wed Nov 17 16:48:36 UTC 2021

On 17/11/2021 16:14, Pedro Lamarão wrote:
> 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
> Thread::startVirtualThread.
> 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.
Testing it out with something real, in this case a web crawler, is a 
great way to provide feedback.

Can you say a few words about the exception handling? Don't you have 
cases where you should abort rather than record exceptions when 
traversing the links in a document?

ThreadFactory::newThread is supposed to return a newly created but not 
started Thread. The javadoc could be a bit clearer on that. I can see 
how you ended up returning a started Thread.


More information about the loom-dev mailing list