4 ms·
Project Loom is in preview, and far from available. As far as I can see, Javalin doesn't make use of virtual threads yet.
by oweiler 4y ago
Project Loom is in preview, and far from available. As far as I can see, Javalin doesn't make use of virtual threads yet.
- tipsee 4y agoIt does :) We use reflection to build the Virtual Thread Factory if the user has Loom enabled in their enviroment: https://github.com/javalin/javalin/blob/master/javalin/src/main/java/io/javalin/util/ConcurrencyUtil.kt#L32-L91 https://github.com/javalin/javalin/blob/master/javalin/src/m...
- pron 4y agoVirtual threads are already available in the current version of the JDK (19) as a Preview feature. Because it's not a preview language feature but a preview API, libraries can use it without compiling with --enable-preview, either with reflection or by having the application supply a virtual thread ThreadFactory, which means they can make use of virtual threads if the application turns preview features on. Preview language features are different as they require compiling with --enable-preview, which creates a "poisoned" class file that cannot be loaded at all without preview enabled, so preview language features are not recommended for use by libraries, but preview APIs are fine (see JEP 12: Preview Features https://openjdk.org/jeps/12 https://openjdk.org/jeps/12).