StructuredExecutor Incompatible with HttpClient?
    Alan Bateman 
    Alan.Bateman at oracle.com
       
    Mon Nov 29 16:01:04 UTC 2021
    
    
  
On 29/11/2021 14:50, Eric Kolotyluk wrote:
> @Alan Bateman <mailto:Alan.Bateman at oracle.com>
> Thanks for trying my example...
>
>  1. Using newThreadPerTaskExecutor() with virtual threads does seem to
>     work fine.
>       * However, it's the StructuredExecutor that I really want to test.
>  2. Did you also run the case with the synchronous HTTP request?
>       * Earlier you implied this should work, but it also failed for me.
>  3. Are you saying that StructuredExecutor will never work with the
>     asynchronous HTTP client?
>       * I am building the HTTP client with the StructuredExecutor, so
>         why is the client using threads outside of the tree?
>
In your example, you specify the executor for async and dependent tasks 
to the HttpClient.Builder. If you drop that one line then I would expect 
both the async and synchronous usages of the API will just work. The 
synchronous form replaces the sendAsync + thenApply(body) + join with 
send + body.
I don't know how common it is to using a custom executor here but it 
does need to examined. It might be that the per-HttpClient "Selector 
Manager" can submitted to the custom executor rather than creating a 
daemon Thread.
-Alan
    
    
More information about the loom-dev
mailing list