AsynchronousSocketChannel

Alan Bateman Alan.Bateman at oracle.com
Fri Dec 4 07:20:42 UTC 2020


On 03/12/2020 21:51, Bill Hastings wrote:
> Are there any recommendations against using AsynchronousSocketChannel with
> virtual threads? If so, I would like to understand the reasons.
It would be a bit an impedance mismatch and not a scenario that we've 
been optimizing for. However, it should work. If you are using the 
Future style then a virtual thread will park gracefully in Future.get 
until the I/O operation completes. If the AsynchronousChannelGroup is 
created with an ExecutorService that creates virtual threads then it 
will create a virtual thread each time that an I/O operation completes 
and the completion handler will be invoked on that thread. The latter 
may not be the more efficient but it would be better if you could try it 
out and report any findings.

-Alan.


More information about the loom-dev mailing list