Sailing Modern Java
summary
Java 21 ships concrete and preview features that change concurrency and native access: virtual threads create millions on a laptop (demo shows 1,000,000 threads; platform threads hit ~32k), they use ~300–400 bytes each and win for I/O but not CPU work; structured concurrency and scoped values simplify cancellation and replace many CompletableFuture patterns; generational ZGC drops worst GC pauses from ~113 ms (G1) to ~1 ms (ZGC) to ~30 μs; the foreign function & memory API adds arenas and memory segments to replace JNI; many APIs remain preview/incubator.
AI-written summary · about
chapters (18)
- 0:00Welcome and introduction
- 1:55Java 21 release overview
- 3:20Java version adoption in production
- 5:48Why upgrade to newer Java versions
- 9:23Virtual threads introduction
- 14:19Demo virtual threads
- 17:30When to use virtual threads
- 19:57Virtual threads pitfalls
- 21:01Structured concurrency
- 24:53Scoped values explained
- 28:09Pattern matching for switch
- 34:09Foreign Function & Memory API
- 39:03Generational ZGC improvements
- 43:36Sequence collections
- 45:23String templates
- 47:52Unnamed classes and instance main
- 49:14Other Java 21 updates
- 50:38Q&A and closing remarks








