Review Request JDK-8240975: Extend NativeLibraries to support explicit unloading

Mandy Chung mandy.chung at
Fri Mar 20 16:17:21 UTC 2020

On 3/20/20 6:51 AM, Alan Bateman wrote:
> On 20/03/2020 03:43, Mandy Chung wrote:
>> Alan, Maurizio,
>> New webrev:
>> newJavaNativeInterfaceLibraries  creates a NativeLIbraries for 
>> loading JNI native libraries.
>>   - native libraries are unloaded when the class loader is reclaimed.
>>   - Support of linking of native method as specified in the JNI spec.
>>   - Restriction on a native library that can only be loaded by one 
>> class loader.
>> newRawNativeLibraries creates  a raw NativeLibraries for loading 
>> non-JNI native libraries.
>>     -  non-JNI native library.  So JNI_OnLoad and JNI_OnUnload will 
>> be ignored.  No support for linking of native method.
>>     - Native libraries not auto-unloaded.  They may be explicitly 
>> unloaded via NativeLibraries::unload.
>>     - No relationship with class loaders.
>> The test is updated to show that JNI_OnLoad and JNI_OnUnload are 
>> ignored.
> "raw" seems okay for now, its internal so can easily be changed if 
> there is a better name or changed further if finer control on the 
> behavior is needed. If you are looking for a shorter name for the 
> factory methods then maybe jniNativeLibraries and rawNativeLibraries 
> would be better.

I like these shorter names.

Updated webrev.02 in place.


More information about the core-libs-dev mailing list