[javaone 2026] Developing an Asynchronous Application with Virtual Threads and Structured Concurrency

Speakers: Jose Paumarrd & Ana-Maria Mihalceanu

See the live blog table of contents


Structured concurrency pattern. Note tasks end by autoclosable block complete

try (var scope - StructuredTaskScope.open()) {

  var subtask = scope.fork(lambda)

scope.join()

var result = subtask.get();

}

Scopes

  • A scope can spawn other scope
  • Closing the parent scope closes the child scopes

Lab

https://github.com/JosePaumard/2026_JavaOne-Loom-lab/blob/Step-00_Initial-application/JavaOne-Loom-Lab.md

My take

This feels like streams where it is going to take me a few tries to “get” it. Luckily, I have time since structured concurrency is still in preview. I did ask my question about ScopedValues being useful without structured concurrency. You can use them but you need a ScopedValue.where() call for each thread as far as I understand which is limited in usefulness.

Leave a Reply

Your email address will not be published. Required fields are marked *