32 import java.util.concurrent.Semaphore;
33 import java.util.concurrent.TimeUnit;
34 import java.util.function.Consumer;
35 import java.util.function.Supplier;
36
37 import jdk.internal.ref.PhantomCleanable;
38 import jdk.internal.ref.WeakCleanable;
39 import jdk.internal.ref.SoftCleanable;
40 import jdk.internal.ref.CleanerFactory;
41
42 import sun.hotspot.WhiteBox;
43
44 import jdk.test.lib.Utils;
45
46 import org.testng.Assert;
47 import org.testng.TestNG;
48 import org.testng.annotations.Test;
49
50 /*
51 * @test
52 * @library /lib/testlibrary /test/lib
53 * @build sun.hotspot.WhiteBox
54 * @build jdk.test.lib.Utils
55 * @modules java.base/jdk.internal
56 * java.base/jdk.internal.misc
57 * java.base/jdk.internal.ref
58 * java.management
59 * @run main ClassFileInstaller sun.hotspot.WhiteBox
60 * @run testng/othervm
61 * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
62 * -verbose:gc CleanerTest
63 */
64
65 @Test
66 public class CleanerTest {
67 // A common CleaningService used by the test for notifications
68 static final Cleaner COMMON = CleanerFactory.cleaner();
69
70 // Access to WhiteBox utilities
71 static final WhiteBox whitebox = WhiteBox.getWhiteBox();
72
73 /**
74 * Test that sequences of the various actions on a Reference
|
32 import java.util.concurrent.Semaphore;
33 import java.util.concurrent.TimeUnit;
34 import java.util.function.Consumer;
35 import java.util.function.Supplier;
36
37 import jdk.internal.ref.PhantomCleanable;
38 import jdk.internal.ref.WeakCleanable;
39 import jdk.internal.ref.SoftCleanable;
40 import jdk.internal.ref.CleanerFactory;
41
42 import sun.hotspot.WhiteBox;
43
44 import jdk.test.lib.Utils;
45
46 import org.testng.Assert;
47 import org.testng.TestNG;
48 import org.testng.annotations.Test;
49
50 /*
51 * @test
52 * @library /test/lib
53 * @build sun.hotspot.WhiteBox
54 * @modules java.base/jdk.internal
55 * java.base/jdk.internal.misc
56 * java.base/jdk.internal.ref
57 * java.management
58 * @run main ClassFileInstaller sun.hotspot.WhiteBox
59 * @run testng/othervm
60 * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
61 * -verbose:gc CleanerTest
62 */
63
64 @Test
65 public class CleanerTest {
66 // A common CleaningService used by the test for notifications
67 static final Cleaner COMMON = CleanerFactory.cleaner();
68
69 // Access to WhiteBox utilities
70 static final WhiteBox whitebox = WhiteBox.getWhiteBox();
71
72 /**
73 * Test that sequences of the various actions on a Reference
|