8290848: LoadLibraryUnload.java still fails with "Too few cleared WeakReferences"
Reviewed-by: mchung, jpai
This commit is contained in:
parent
923462467e
commit
c1040897cd
@ -29,5 +29,4 @@
|
|||||||
|
|
||||||
java/lang/invoke/MethodHandles/CatchExceptionTest.java 8146623 generic-all
|
java/lang/invoke/MethodHandles/CatchExceptionTest.java 8146623 generic-all
|
||||||
java/lang/ref/ReferenceEnqueue.java 8284236 generic-all
|
java/lang/ref/ReferenceEnqueue.java 8284236 generic-all
|
||||||
java/lang/ClassLoader/loadLibraryUnload/LoadLibraryUnload.java 8290848 generic-all
|
|
||||||
java/lang/ProcessBuilder/PipelineLeaksFD.java 8290885 generic-all
|
java/lang/ProcessBuilder/PipelineLeaksFD.java 8290885 generic-all
|
||||||
|
@ -26,7 +26,8 @@
|
|||||||
* LoadLibraryUnload class calls ClassLoader.loadedLibrary from multiple threads
|
* LoadLibraryUnload class calls ClassLoader.loadedLibrary from multiple threads
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* @test
|
* The driver for this test is LoadLibraryUnloadTest.java.
|
||||||
|
*
|
||||||
* @bug 8266310
|
* @bug 8266310
|
||||||
* @summary Loads a native library from multiple class loaders and multiple
|
* @summary Loads a native library from multiple class loaders and multiple
|
||||||
* threads. This creates a race for loading the library. The winner
|
* threads. This creates a race for loading the library. The winner
|
||||||
@ -35,14 +36,12 @@
|
|||||||
* loaded in a different class loader that won the race. The test
|
* loaded in a different class loader that won the race. The test
|
||||||
* checks that the loaded class is GC'ed, that means the class loader
|
* checks that the loaded class is GC'ed, that means the class loader
|
||||||
* is GC'ed and the native library is unloaded.
|
* is GC'ed and the native library is unloaded.
|
||||||
* @library /test/lib
|
|
||||||
* @build LoadLibraryUnload p.Class1
|
|
||||||
* @run main/othervm/native -Xcheck:jni LoadLibraryUnload
|
|
||||||
*/
|
*/
|
||||||
import jdk.test.lib.Asserts;
|
import jdk.test.lib.Asserts;
|
||||||
import jdk.test.lib.Utils;
|
import jdk.test.lib.Utils;
|
||||||
|
|
||||||
import java.lang.*;
|
import java.lang.*;
|
||||||
|
import java.lang.ref.Reference;
|
||||||
import java.lang.ref.ReferenceQueue;
|
import java.lang.ref.ReferenceQueue;
|
||||||
import java.lang.reflect.*;
|
import java.lang.reflect.*;
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
@ -161,7 +160,6 @@ public class LoadLibraryUnload {
|
|||||||
threads = null;
|
threads = null;
|
||||||
canary = null;
|
canary = null;
|
||||||
exceptions.clear();
|
exceptions.clear();
|
||||||
|
|
||||||
// Wait for the canary for each of the libraries to be GC'd
|
// Wait for the canary for each of the libraries to be GC'd
|
||||||
// before exiting the test.
|
// before exiting the test.
|
||||||
for (int i = 0; i < LOADER_COUNT; i++) {
|
for (int i = 0; i < LOADER_COUNT; i++) {
|
||||||
@ -172,5 +170,7 @@ public class LoadLibraryUnload {
|
|||||||
Asserts.fail("Too few cleared WeakReferences");
|
Asserts.fail("Too few cleared WeakReferences");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Ensure the WeakReferences are strongly referenced until they can be dequeued
|
||||||
|
Reference.reachabilityFence(wCanary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user