1
sagaxu 22 小时 57 分钟前
https://openjdk.org/jeps/444#Pinning
There are two scenarios in which a virtual thread cannot be unmounted during blocking operations because it is pinned to its carrier: When it executes code inside a synchronized block or method, or When it executes a native method or a foreign function. 第一个坑: https://openjdk.org/jeps/491 ,首个解决此问题的 JDK LTS 版本是 25 。 第二个坑:目前没有办法根治,知名库如 netty 的 native 代码应该能比较快发现和解决。 所以还是再等等吧,反正已经用上 Kotlin 协程了,等 virtual threads 成熟了拿来当阻塞 IO 的 dispatcher 用 Executors.newVirtualThreadPerTaskExecutor().asCoroutineDispatcher() |
2
niubiman 8 小时 48 分钟前
java 真是遥遥领先
|