Java 18
JEP 420: Pattern Matching for switch (Second Preview) (opens in a new tab)
Java 19
JEP 427: Pattern Matching for switch (Third Preview) (opens in a new tab)
Java 21
- OpenJDK - JDK 21 (opens in a new tab)
- Oracle Blog - Java Blog - The Arrival of Java 21 (opens in a new tab)
JEP 430: String Templates (Preview) (opens in a new tab)
JEP 431: Sequenced Collections (opens in a new tab)
JEP 439: Generational ZGC (opens in a new tab)
JEP 442: Foreign Function & Memory API (Third Preview) (opens in a new tab)
JEP 444: Virtual Threads (opens in a new tab)
-
Oracle - Java SE - 21 - Core Libraries - 14 Concurrency - Virtual Threads (opens in a new tab)
Virtual threads
can significantly improve thethroughput
—not the latency—of servers written in thethread-per-request
style. In this style, the server dedicates a thread to processing each incoming request for its entire duration.-
How to use
-
Write Simple, Synchronous Code Employing Blocking I/O APIs in the
Thread-Per-Request
Style -
Represent Every Concurrent Task as a
Virtual Thread
; Never PoolVirtual Threads
-
Use
Semaphores
to Limit Concurrency -
Don't Cache Expensive Reusable Objects in Thread-Local Variables
Use
Scoped Values
as a modern alternative tothread-local
variables. -
Avoid Lengthy and Frequent Pinning
-
-