Coreoz / Wisp

A simple Java Scheduler library with a minimal footprint and a straightforward API
Apache License 2.0
131 stars 22 forks source link

Use virtual threads instead of a thread pool #18

Open amanteaux opened 1 year ago

amanteaux commented 1 year ago

Virtual threads are becoming a reality since Java 19, though currently they are only available through preview usage of the JVM: --enable-preview.

When virtual threads are fully part of the JVM, Wisp core should be rewritten to use virtual threads:

amanteaux commented 2 weeks ago

For now this is paused because virtual threads must use only code that is not dependent on the synchronized keyword. Since this keyword is used widely in the JDK itselft, it is not safe enough to rely on virtual threads. Especially when the gains are not clear. When this feature is implemented, a benchmark needs to clarify the gains of switching to virtual threads.