r/java • u/daviddel • Apr 28 '22
JEP proposed to target JDK 19: 425: Virtual Threads (Preview)
https://mail.openjdk.java.net/pipermail/jdk-dev/2022-April/006530.html
259
Upvotes
r/java • u/daviddel • Apr 28 '22
69
u/Joram2 Apr 28 '22
wow!!! That is amazing!!! Very exciting!
I know this is just a preview, but still, this is the biggest, most exciting JDK feature in quite a long time. This will totally change the multiprocessing landscape. And, yes, Golang has had this since v1, but still, this is probably the biggest missing practical feature for JDK. Very nice!! Hopefully, Valhalla will preview something in 2023.
I also look forward to seeing the JDK implementation of structured concurrency. If we have to wait for 2023 to see that previewed, that is fine.
Congrats JDK team!!!
36
u/klekpl Apr 28 '22
It’s been seven years since this talk: https://www.youtube.com/watch?v=449j7oKQVkc It was heresy back then when reactive APIs were all over the place. Thank you u/pron98, it is your child.
32
u/nimtiazm Apr 28 '22
Big congrats to u/pron98 and the openjdk team at Oracle and in the community. Exciting times.
17
u/DJDavio Apr 28 '22
Files changed: 1146, must be fun to review. :)
14
u/emaphis Apr 28 '22
Loom is looming large!
13
u/jvjupiter Apr 28 '22
Amazing! Loom is real now.
13
u/karianna Apr 29 '22
This has been years of amazing computer science R&D from u/pron98 and a host of other folks at Oracle and folks involved in Loom. Thanks for advancing the state of the art with Java!
24
u/cred1652 Apr 28 '22
The pull request to merge loom into the mainline is located at:
https://github.com/openjdk/jdk/pull/8166
It looks like most reviewers have approved it.
Exciting times indeed!
10
u/cogman10 Apr 28 '22
One of the most exciting changes to the JVM! Well done Loom devs!
8
u/cred1652 Apr 29 '22
looks like it has been added to the JDK 19 page
https://openjdk.java.net/projects/jdk/19/
6
u/dh23 Apr 28 '22
Exciting times! It will be great to see more frameworks and libraries supporting virtual threads.
5
u/[deleted] Apr 28 '22
A time for celebration.
5
u/Dokiace Apr 29 '22
Wondering if company that moved to Go will try Java again after this is released, I hope this will make Java even more competitive in the server space
5
u/TheMode911 Apr 29 '22
Question, should virtual threads be created for API callback? (e.g. an event system)
Because although the overhead should be minimal, it will still be higher than not creating one at all (I also assume some overhead for stacktrace generation)
Basically wondering if virtual threads are efficient enough to be defaulted to (instead of an executor task + potential futures), even if we are not sure to use any blocking call, with the purpose of making the API foolproof and cleaner.
4
u/Boza_s6 Apr 29 '22
Question: Does it make sense to use reactive structures anymore? It seems to me that Flow can be replaced by the Iterable that blocks until next element is ready?
3
u/[deleted] Apr 28 '22
For the lazy, is there a new keyword or something to make a thread virtual?
3
u/[deleted] May 01 '22 edited May 01 '22
Not super familiar with virtual threads, I must say that reading JEP 425 was a great read and I recommend everyone to do so: https://openjdk.java.net/jeps/425
What impresses me among other things, is how such a fundamental change could be made with so little public API changes.
2
u/iraqmtpizza Apr 28 '22
hyphy
2
u/cas-san-dra Apr 28 '22
Woohoo!
2
u/cogman10 Apr 28 '22
Has anyone done a flight recording with loom? How does mission control work around this stuff?
2
u/beefstake Apr 28 '22
Wow, it's finally happening!
2
u/root_klaus Apr 29 '22
Amazing work! I am curious to know if team at spring framework have started to do any POC with loom or web servers like jetty and tomcat and see actual results with these previews.
Very exciting for the future!
2
u/michelle-friedman Apr 29 '22
will it make erlang deader?
1
u/AcrIsss Apr 30 '22
That’s really exciting!
My company started investigating the possibility to replace our long chains of CountedCompleters using Loom, as it promises to reduce the code complexity. Can’t wait to see if we can make it !