Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8247966: runtime/logging/loadLibraryTest/LoadLibraryTest.java failed …
…"RuntimeException: 'Unloaded library with handle' missing from stdout/stderr"

Make sure the native library is unloaded before exiting the main thread.

Reviewed-by: dcubed, dholmes
  • Loading branch information
Harold Seigel committed Jun 24, 2020
1 parent 9584e01 commit 112a4bd8bc8c11b0c97a02190408a7f91eed2330
Showing 1 changed file with 16 additions and 0 deletions.
@@ -64,6 +64,22 @@ public static void main(String[] args) throws Exception {
WhiteBox wb = WhiteBox.getWhiteBox();
if (!wb.isClassAlive(CLASS_NAME)) {
System.out.println("Class LoadLibraryClass was unloaded");
while (true) {
try {
System.loadLibrary("LoadLibraryClass");
// Able to load the library with this class's class loader
// so it must have been unloaded by myLoader.
break;
} catch(java.lang.UnsatisfiedLinkError e) {
if (e.getMessage().contains("already loaded in another classloader")) {
// Library has not been unloaded yet, so wait a little and check again.
Thread.sleep(10);
} else {
throw new RuntimeException(
"Unexpected UnsatisfiedLinkError: " + e.getMessage());
}
}
}
}
}

0 comments on commit 112a4bd

Please sign in to comment.