Wrapping virtual threads in predefined ExecutorService.
Attila Kelemen
attila.kelemen85 at gmail.com
Fri Jun 16 21:30:39 UTC 2023
`ThreadPoolExecutor` already allows a custom `ThreadFactory` to which you
can pass `Executors.newVirtualThreadPerTaskExecutor()`. However, why would
you create a new server using loom on thread/core when you want to rely on
virtual threads? That just means that you are pooling virtual threads which
seems to be pointless (basically you are creating a queue in order to put
them in another). If you want to limit the number of concurrent access,
then you can do that with a semaphore.
Attila
Andrii Lomakin <lomakin.andrey at gmail.com> ezt írta (időpont: 2023. jún.
16., P, 7:59):
> Good day devs!
> I am considering the creation of a database server that is working on
> thread-per-core architecture. So I have a question: do you have plans to
> implement the possibility of using virtual threads executor on the base of
> a passed executor?
>
> P.S. I am aware of problems with synchronization inside JDK classes,
> libraries, and pinned threads.
>
> --
> Best regards,
> Andrii Lomakin.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/loom-dev/attachments/20230616/37361d74/attachment-0001.htm>
More information about the loom-dev
mailing list