Language selector

Virtual Threads

How to enable Virtual Threads? During my talks about Java 19 (which have the mandatory part dedicated to Virtual Threads), I’ve been asked: how do I enable Virtual Threads in the JVM? quite a few times. This question carries an assumption that there’s some kind of switch, which has to be activated or hit to “magically” turn good ol' Threads into Virtual Threads. AFAICT there is no such thing right now, and I rather doubt there will be one in the future.
Let’s be honest: we’ve been waiting for the Virtual Threads quite some time. We’ve been waiting eagerly, we’ve seen names changing (they’re not fibers folks), but here there finally are: Virtual Threads. Some say the Project Loom is the biggest change Java has seen since version 8, lambdas, and streams. Some say it’s even bigger than that. Discussion aside, they are a huge change, it seems. I remember how we were excited (I was still at the university back then), that we could finally use some real Threads in Java on Windows.
Hey, there are two major Java versions released every year! We don’t have to wait 3 years or so for new features anymore. Isn’t that cool? 😉 Java was supposed “to be slow”. However, Java turns out to evolve so fast, that next releases aren’t just version bumps, but might significantly change the rules of the game. That’s a good reason to check out what’s new in Java. To name a few changes:

Language selector