Taking project Loom for a spin. Java and Scala examples

Brian Schlining
1 min readOct 19, 2022

If you’re a Java developer, you’ve likely heard about project Loom. It delivers virtual threads and structured concurrency as preview features in Java 19. There are a number of articles out there with details on them, but they all leave out important details to actually get these new features running in code. Here are two brief but complete examples to help get you going. The most important bits are the following command line flags:

  • --enable-preview — This flag enables preview features like Loom.

--

--

Brian Schlining

Polyglot coder. Deep-sea Researcher. Zazen aficionado. I think squids are pretty cool.