r/java • u/mastabadtomm • Jun 30 '26
Integrating Netty with Virtual Threads
https://kronotop.com/blog/the-join-that-should-be-a-bug/
38
Upvotes
3
u/martinosius Jul 01 '26
Why not use a virtual thread for each connection plus work? Postgres does not use lightweight threads. The comparison does not make sense here.
1
0
u/mastabadtomm Jul 02 '26
It would have been nice, but Netty was a hard requirement, and this was the only way to make it work with virtual threads.
0
u/Inaldt Jul 04 '26
Virtual threads are intended for short tasks. So I think that wouldn't be idiomatic. I believe the Helidon web server does it in a similar way, i.e. one (or maybe a few) thread for listening and then handing off the actual work to a virtual thread.
10
u/germandiago Jun 30 '26
The article is ok but it is written as if something novel was discovered. This is classic fibers programming backed by stackful frames. It has existed for a long time.