Concurrency and Exceptions

Alan Bateman Alan.Bateman at oracle.com
Wed Dec 1 09:40:24 UTC 2021


On 30/11/2021 22:25, Eric Kolotyluk wrote:
> :
>
>
> Will it be okay to pass a StructuredExecutor instance to 
> CompletableFuture CompletionStage? I imagine this could be unsafe if 
> we pass a CompletableFuture outside the ScopeLocal of the Thread Tree, 
> but then passing the Future out would be just as unsafe.
>
I think we'll need to re-visit implementing Executor as it does create a 
footgun. Your example where you specified a SE to the HttpClient.Builder 
for async and dependent tasks was very useful. With CF.xxxAsync(... 
Executor) then you may run into the same issue where execute may fail 
with RejectedExecutionException because it is called on a thread from 
outside the tree.

-Alan


More information about the loom-dev mailing list