Java 19 Now Available for Production Use: Features Include Structured Concurrency, Virtual Threads, Pattern Matching for Switch Expressions, a Vector API, and a Linux/RISC-V Port.
Java Development Kit 19, a non-LTS (long-term support) release, is now available for production use, following its introduction today. This release introduces several significant updates and features, enhancing Java’s capabilities and addressing various aspects of modern software development.
One of the standout features in JDK 19 is structured concurrency, which is currently in its incubator phase. This feature aims to simplify the complexities of multithreaded programming by treating multiple tasks running in different threads as a unified unit of work. By streamlining error handling and task cancellation, structured concurrency enhances both reliability and observability. This innovation comes from Project Loom, which is focused on developing a new, lightweight concurrency model that promises to make high-throughput applications easier to manage.
Another major addition is record patterns, which are being introduced as a preview feature. Record patterns allow developers to deconstruct record values and navigate complex data structures more efficiently. They build on the pattern matching for instanceof
feature introduced in JDK 16, and future iterations may include additional patterns such as array patterns and vararg patterns. This feature is part of Project Amber, which explores productivity-oriented enhancements for Java.
JDK 19 also previews a foreign function and memory API, designed to improve how Java programs interact with code and data outside the Java runtime. This API enables Java to call native libraries and process non-JVM-managed memory more safely and efficiently than with the traditional Java Native Interface (JNI). The API combines two earlier incubating APIs—the foreign memory access API and the foreign linker API—and focuses on ease of use, performance, and safety.
The virtual threads feature, also in preview, introduces lightweight threads that significantly ease the development and maintenance of high-throughput concurrent applications. Virtual threads are designed to scale efficiently with hardware and integrate with existing thread-based code with minimal changes. This feature is part of Project Loom and aims to improve the usability and performance of multithreaded Java applications without altering the fundamental concurrency model.
Additionally, JDK 19 includes support for the Linux/RISC-V instruction set architecture (ISA), expanding the range of platforms where Java can run. This addition reflects the ongoing efforts to make Java more versatile and adaptable to various hardware environments.
JDK 19 follows a rigorous release schedule, arriving after two release candidates and two rampdown phases since June. It continues the standard Java’s six-month release cadence, with JDK 18 having been released earlier in the year. Although JDK 19 is a non-LTS release, it sets the stage for future developments and improvements in the Java ecosystem.