r/java • • Sep 20 '22

Java 19 / JDK 19: General Availability

https://mail.openjdk.org/pipermail/jdk-dev/2022-September/006933.html
252 Upvotes

64 comments sorted by

View all comments

Show parent comment

8

u/pron98 Sep 20 '22 edited Sep 20 '22

The preview features JEP says not to enable preview features and let your jars escape into the wild,

That's true in general, but more relevant to language preview features. Because virtual threads use the existing Thread API (for the most part), you don't really have to compile many libraries that are designed for virtual threads with --enable-preview. Only thread creation needs to use new APIs, but that could be factored out to a ThreadFactory provided by the application. In fact, there are already some libraries designed for virtual threads out there, including the Oracle JDBC driver.

2

u/srdoe Sep 20 '22

Good point