mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-18 10:04:42 +02:00
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
1 changed files with 16 additions and 0 deletions
|
@ -64,6 +64,22 @@ public class LoadLibraryTest {
|
||||||
WhiteBox wb = WhiteBox.getWhiteBox();
|
WhiteBox wb = WhiteBox.getWhiteBox();
|
||||||
if (!wb.isClassAlive(CLASS_NAME)) {
|
if (!wb.isClassAlive(CLASS_NAME)) {
|
||||||
System.out.println("Class LoadLibraryClass was unloaded");
|
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…
Add table
Add a link
Reference in a new issue