3 ms·
In the past I have followed this approach myself. But that is changing. If you want to future proof your code, don't use classic locks. Project Loom doesn't
by diroussel 7y ago
In the past I have followed this approach myself. But that is changing. If you want to future proof your code, don't use classic locks.
Project Loom doesn't work with classic locks, and the java.nio package is has been re-written to remove classic locks:
> In Project Loom, there will be support for efficiently switching between fibers that use Java 5 locks (that is, the java.util.concurrent.lock package) but not native C locks. As a result, it is necessary to migrate all blocking code in the JDK over to Java 5 locks. So the legacy Socket API required reimplementation to achieve better compatibility with Project Loom.
See: https://blogs.oracle.com/javamagazine/inside-java-13s-switch-expressions-and-reimplemented-socket-api https://blogs.oracle.com/javamagazine/inside-java-13s-switch...