JDK 19 - Virtual Threads Testing!

David Delabassee david.delabassee at oracle.com
Mon May 16 08:55:33 UTC 2022

Welcome to a new OpenJDK Quality Outreach update!

This time, we have one update but a major one: JEP 425 (Virtual Threads 
preview) has been integrated into the OpenJDK mainline! JDK 19 
Early-Access builds 22 are the first mainline builds with Virtual 
Threads (preview) support. So, Project Loom is now getting closer and 

Please make sure to check the Heads-up below even if you don’t intend to 
use virtual threads in the short future.

## Heads-up - JEP 425 Virtual Threads (preview) testing

The goal of Project Loom is to introduce in the Java platform an 
easy-to-use, high-throughput lightweight concurrency model, and a 
related new concurrent programming model.

Developed in Project Loom, JEP 425 introduces virtual threads to the 
Java Platform. Virtual threads are lightweight threads that dramatically 
reduce the effort of writing, maintaining, and observing high-throughput 
concurrent applications. Note that virtual threads are a preview API in 
JDK 19. Please make sure to read 'JEP 425: Virtual Threads (Preview)' 
for a detailed explanation.

A lot of testing has already been done but we are asking, once again, 
your help to test your project(s) with the latest JDK 19 Early-Access 
builds, even if you don’t intend to use virtual threads any time soon.

There are two approaches to test your project:
1. Update your code to use virtual threads …or
2. Simply test your existing unchanged code with the preview feature 

Both approaches should yield valuable feedback.

If you choose to adapt your application to use virtual threads (cf. 
JavaDoc [2]), be aware that in some cases it’s not just about updating 
your code to use virtual threads instead of platform threads; there are 
some additional considerations. For example, virtual threads shouldn’t 
be pooled [3], code that relies heavily on thread locals [4] will 
require some work to move to a world where there is a new thread for 
each task, etc.

Given that are some minor behavior changes and that `ThreadGroup` has 
been degraded, testing your code as-is, i.e., without using virtual 
threads but with the preview feature enabled at runtime, will also be 
useful. For more details, please check 'JEP 425 - Risks and Assumptions' 

One difference between to the EA builds published by Project Loom and 
the latest JDK 19 EA builds is that the `--enable-preview` flag is 
required at run-time to use the new APIs. It’s not possible to use the 
APIs with core reflection to avoid the need for `--enable-preview`.

Finally, some tools especially tools relying on JVM TI agents might not 
be fully ready for virtual threads.

Your help testing this important update is greatly appreciated, all 
feedback should be sent to the 'loom-dev' mailing list [6].

[1] https://openjdk.java.net/jeps/425
[3] https://openjdk.java.net/jeps/425#Do-not-pool-virtual-threads
[4] https://openjdk.java.net/jeps/425#Thread-local-variables
[5] https://openjdk.java.net/jeps/425#Risks-and-Assumptions
[6] https://mail.openjdk.java.net/pipermail/loom-dev/

## JDK 19 Early-Access builds

JDK 19 Early-Access builds 22 are now available [7], and are provided 
under the GNU General Public License v2, with the Classpath Exception. 
Make sure to check the Release Notes [8] and the JavaDoc [9].

[7] https://jdk.java.net/19/
[8] https://jdk.java.net/19/release-notes
[9] https://download.java.net/java/early_access/jdk19/docs/

### Current JDK 19 JEPs
- 405: Record Patterns (Preview) - Proposed to target
- 422: Linux/RISC-V Port - Integrated
- 424: Foreign Function & Memory API (Preview) - Integrated
- 425: Virtual Threads (Preview) - Integrated
- 426: Vector API (4th Incubator) - Targeted
- 427: Pattern Matching for switch (3rd Preview) - Targeted

### Recent changes that may be of interest:

Build 22:
- JDK-8284161: Implementation of Virtual Threads (Preview)
- JDK-8285947: Avoid redundant HashMap.containsKey calls in ZoneName
- JDK-8212136: Remove finalizer implementation in SSLSocketImpl
- JDK-8285872: JFR: Remove finalize() methods
- JDK-8285914: AppCDS crash when using shared archive with old class file
- JDK-8286163: micro-optimize Instant.plusSeconds
- JDK-8282420: JFR: Remove event handlers
- JDK-8282559: Allow multiple search terms in javadoc search

Build 21:
- JDK-8255552: Add DES/3DES/MD5 to jdk.security.legacyAlgorithms
- JDK-8278370: [win] Disable side-by-side installations of multiple JDK 
updates in Windows JDK installers
- JDK-8281010: [macos] Disable side-by-side installations of multiple 
JDK updates in macOS JDK installers
- JDK-8236128: Allow jpackage create installers for services
- JDK-8279598: provide adapter from RandomGenerator to Random

Build 20:
- JDK-8284553: Deprecate the DEFAULT static field of OAEPParameterSpec
- JDK-8283620: System.out does not use the encoding/charset specified in 
the Javadoc
- JDK-8285445: Enable Windows Alternate Data Streams by default
- JDK-8284930: Re-examine FilterInputStream mark/reset
- JDK-8284890: Support for Do not fragment IP socket options
- JDK-8282823: javac should constrain more uses of preview APIs
- JDK-8285477: Add a PRECISION public static field to j.l.Float and 

Build 19:
- JDK-8186958: New Methods to Create Preallocated HashMaps
- JDK-8284775: Simplify String.substring(_, length()) calls
- JDK-8283892: Compress and expand bits
- JDK-8280915: Better parallelization for AbstractSpliterator and IteratorS…
- JDK-8284681: compiler/c2/aarch64/TestFarJump.java fails with "RuntimeExce…
- JDK-8283790: G1: Remove redundant card/heap-address transition
- JDK-8285001: Simplify StringLatin1.regionMatches
- JDK-8284880: Re-examine sun.invoke.util.Wrapper hash tables
- JDK-8278356: Improve file creation

## Topics of Interest

- Java Cryptographic Roadmap update 
- Virtual Thread Deep Dive 
- Why Write an Empty finalize() Method? 
- WHEN and NULL In Pattern Matching 
- JDK 8 to JDK 18 in GC: 10 Releases, 2000+ Enhancements 
- ZGC - What's new in JDK 18 https://malloc.se/blog/zgc-jdk18
- Java Next - From Amber to Loom, from Panama to Valhalla 

## JDK Update Patch Release

As announced with the April 2022 CPU release, we have produced update 
patch releases for all Java SE supported versions. The new versions are 
JDK (publicly available), (publicly available),, 8u333, 7u343, and OpenJDK (publicly available).

As usual, let us know if you find any issues while testing your 
project(s) on the latest JDK early-access builds. Thanks for your support!


More information about the quality-discuss mailing list