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
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.