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
This commit is contained in:
parent
9584e01d24
commit
112a4bd8bc
@ -64,6 +64,22 @@ public class LoadLibraryTest {
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user