< prev index next >
test/hotspot/jtreg/runtime/logging/loadLibraryTest/LoadLibraryTest.java
Print this page
@@ -62,10 +62,26 @@
runTest();
ClassUnloadCommon.triggerUnloading();
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());
+ }
+ }
+ }
}
}
public static class MyClassLoader extends ClassLoader {
< prev index next >