Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix potential double unload of JNI libraries on Java 11+
Previously, the addHookForLibUnloading method added a shutdown hook unconditionally to unload JNI libraries. This could potentially lead to double unload issues on Java 11 and later versions where the JVM automatically handles JNI library cleanup. This commit modifies addHookForLibUnloading to conditionally add the unload hook based on the JVM version: - For Java 11 and later, the method adds a no-op hook since the JVM handles the cleanup automatically. - For Java versions prior to 11, the method adds the provided hook to ensure proper cleanup. This change ensures compatibility and prevents potential double unload issues on Java 11 and later.
- Loading branch information