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 comments

11

u/Joram2 Sep 20 '22

AFAIK, preview features are production ready, but APIs are evolving and not stable. You can use virtual threads in production Java apps now, with Java 19. Major frameworks will want to hold off until the feature is out of preview and is stable. But for small teams, evolving APIs aren't a big deal, virtual threads are ready to use.

3

u/[deleted] Sep 20 '22

You really shouldn’t use preview features in production

6

u/RupertMaddenAbbott Sep 20 '22

This is not true - preview features are not not-intended for production use. Read the JEP: https://openjdk.org/jeps/12

You have to weigh the pros/cons but a blanket ban is not right.

6

u/srdoe Sep 20 '22

It's not a blanket ban, but the JEP does say

These class files are special; they should not be distributed beyond the control of the developer who chose to use preview features.

about files you generate with --enable-preview.

Also putting preview features into production is impractical unless you control the production environment yourself, since your code will now have both a minimum and maximum JDK version of 19.

7

u/RupertMaddenAbbott Sep 20 '22

Completely agree. Preview features are not for (non-toy or non-internal) libraries or for deployments where you are not distributing your own JVM.

I think that leaves quite a substantial number of projects, especially server side applications, where this might be appropriate.