--

Suppose the functionality offered by a native method or foreign function exists in pure JAVA libraries. In that case, rewriting your code to use those libraries is the best approach to use the JAVA virtual threads feature. This avoids pinning and leverages the full benefits of virtual threads.

There are many native methods in JDK itself like hashcode, wait, notify, etc?

Try to replace native code with JAVA libraries if possible. The future of the JAVA version might bring optimized native implementations or new APIs for virtual threads.

--

--

No responses yet