|
|
|
|
|
by samus
890 days ago
|
|
Virtual threads were never intended as a drop-in replacement for platform threads. They offer the same API, but they are for different usage scenarios. If you have lots of blocking I/O (meaning: waiting for things happening on other threads or processes, which offers scheduling opportunities), use virtual threads. If you compute or call native code, keep using platform threads. The issue with synchronized is eventually going to be resolved. But long-running computations (sorting, parsing, number crunching, etc) or native calls must also in the future be offloaded to an ExecutorService with platform threads. |
|