r/java • • Apr 06 '22

JEP 425: Virtual Threads (Preview)

https://openjdk.java.net/jeps/425
175 Upvotes

50 comments sorted by

View all comments

Show parent comments

14

u/koreth Apr 06 '22

At the risk of committing a faux pas by talking Kotlin in the Java subreddit: My understanding is that the two will play well together: it'll be easy to run coroutines on virtual-thread-based executors.

Obviously with virtual threads, coroutines will become unnecessary in some places where they're currently used as a way to run code on multiple threads. But as a language feature, coroutines are more than just a threading abstraction: they're used for dynamic generation of sequences and other things. Those use cases will still be just as valid in a Loom-based world.

9

u/buyIdris666 Apr 06 '22

Meh. Like async, coroutines will be a rarely used niche feature once Loom lands. Virtual threads appear to give 95% of the performance benefit while letting you write "normal" code. Very rare you need that extra 5%

1

u/pavi2410 Apr 10 '22

Do mind that JVM is one of the compilation targets for Kotlin

2

u/buyIdris666 Apr 10 '22

Kotlin and JVM grow farther apart every day. Google wasn't happy with their platform using a language they didn't own.

Remember Android still only support Java 8. Soon (even now) you can't use Java libraries in Kotlin/Android anymore because they require 11.

Android doesn't use JVM, doesn't use same class file format. And now it doesn't use the same language either. I'm not optimistic about future of Kotlin on anything except Android for all these reasons