8010668: builtin JNI libraries should not be unloaded
authorchegar
Mon, 25 Mar 2013 14:29:13 +0000
changeset 16506 2a43ffb8a318
parent 16505 bdc5cd3377a4
child 16507 75bde2ca0061
8010668: builtin JNI libraries should not be unloaded Reviewed-by: chegar, alanb Contributed-by: Bill Pittore <bill.pittore@oracle.com>
jdk/src/share/native/java/lang/ClassLoader.c
--- a/jdk/src/share/native/java/lang/ClassLoader.c	Mon Mar 25 19:25:01 2013 +0530
+++ b/jdk/src/share/native/java/lang/ClassLoader.c	Mon Mar 25 14:29:13 2013 +0000
@@ -398,7 +398,9 @@
         if (cause) {
             (*env)->ExceptionClear(env);
             (*env)->Throw(env, cause);
-            JVM_UnloadLibrary(handle);
+            if (!isBuiltin) {
+                JVM_UnloadLibrary(handle);
+            }
             goto done;
         }
 
@@ -409,7 +411,9 @@
                          "unsupported JNI version 0x%08X required by %s",
                          jniVersion, cname);
             JNU_ThrowByName(env, "java/lang/UnsatisfiedLinkError", msg);
-            JVM_UnloadLibrary(handle);
+            if (!isBuiltin) {
+                JVM_UnloadLibrary(handle);
+            }
             goto done;
         }
         (*env)->SetIntField(env, this, jniVersionID, jniVersion);
@@ -458,7 +462,9 @@
         (*env)->GetJavaVM(env, &jvm);
         (*JNI_OnUnload)(jvm, NULL);
     }
-    JVM_UnloadLibrary(handle);
+    if (!isBuiltin) {
+        JVM_UnloadLibrary(handle);
+    }
     JNU_ReleaseStringPlatformChars(env, name, cname);
 }