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

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Fri Mar 20 16:49:41 UTC 2020


Looks good! Thanks!

Maurizio

On 20/03/2020 16:17, Mandy Chung wrote:
>
>
> On 3/20/20 6:51 AM, Alan Bateman wrote:
>> On 20/03/2020 03:43, Mandy Chung wrote:
>>> Alan, Maurizio,
>>>
>>> New webrev:
>>> http://cr.openjdk.java.net/~mchung/jdk15/webrevs/8240975/webrev.02/
>>>
>>> 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.
>
> Mandy


More information about the core-libs-dev mailing list