Resubmitting the following PR https://github.com/openjdk/jdk/pull/3976 against JDK17.
This fixes the deadlock in ClassLoader between the two lock objects - a lock object associated with the class being loaded, and the ClassLoader.loadedLibraryNames hash map, locked during the native library load operation. Further details can be found in the original PR. Testing: jtreg and jck testing with no regressions. A new regression test was developed. ------------- Commit messages: - JDK-8266310: deadlock between System.loadLibrary and JNI FindClass loading another class Changes: https://git.openjdk.java.net/jdk17/pull/96/files Webrev: https://webrevs.openjdk.java.net/?repo=jdk17&pr=96&range=00 Issue: https://bugs.openjdk.java.net/browse/JDK-8266310 Stats: 913 lines in 10 files changed: 894 ins; 1 del; 18 mod Patch: https://git.openjdk.java.net/jdk17/pull/96.diff Fetch: git fetch https://git.openjdk.java.net/jdk17 pull/96/head:pull/96 PR: https://git.openjdk.java.net/jdk17/pull/96