21 * questions.
22 */
23
24 import java.io.BufferedReader;
25 import java.io.InputStream;
26 import java.io.InputStreamReader;
27
28 import static jdk.testlibrary.Asserts.assertGreaterThan;
29 import jdk.testlibrary.ProcessTools;
30
31 import com.sun.tools.attach.AttachNotSupportedException;
32 import com.sun.tools.attach.VirtualMachine;
33
34 import sun.tools.attach.HotSpotVirtualMachine;
35
36 /*
37 * @test
38 * @bug 6942989
39 * @summary Check for WeakReference leak in Logger and anonymous Logger objects
40 * @library /lib/testlibrary
41 * @build jdk.testlibrary.*
42 * @run main/othervm TestLoggerWeakRefLeak Logger
43 * @run main/othervm TestLoggerWeakRefLeak AnonymousLogger
44 */
45 public class TestLoggerWeakRefLeak {
46
47 private static final String TARGET_CLASS = "java.lang.ref.WeakReference";
48 private static final int INSTANCE_COUNT = 100;
49 private static int loggerCount = 0;
50
51 public static void main(String[] args) throws Exception {
52 if (args[0].equals("AnonymousLogger")) {
53 System.out.println("Test for WeakReference leak in AnonymousLogger object");
54 testIfLeaking(TestLoggerWeakRefLeak::callAnonymousLogger);
55 } else {
56 System.out.println("Test for WeakReference leak in Logger object");
57 testIfLeaking(TestLoggerWeakRefLeak::callLogger);
58 }
59 }
60
61 /**
|
21 * questions.
22 */
23
24 import java.io.BufferedReader;
25 import java.io.InputStream;
26 import java.io.InputStreamReader;
27
28 import static jdk.testlibrary.Asserts.assertGreaterThan;
29 import jdk.testlibrary.ProcessTools;
30
31 import com.sun.tools.attach.AttachNotSupportedException;
32 import com.sun.tools.attach.VirtualMachine;
33
34 import sun.tools.attach.HotSpotVirtualMachine;
35
36 /*
37 * @test
38 * @bug 6942989
39 * @summary Check for WeakReference leak in Logger and anonymous Logger objects
40 * @library /lib/testlibrary
41 * @modules jdk.attach/sun.tools.attach
42 * @build jdk.testlibrary.ProcessTools
43 * @run main/othervm TestLoggerWeakRefLeak Logger
44 * @run main/othervm TestLoggerWeakRefLeak AnonymousLogger
45 */
46 public class TestLoggerWeakRefLeak {
47
48 private static final String TARGET_CLASS = "java.lang.ref.WeakReference";
49 private static final int INSTANCE_COUNT = 100;
50 private static int loggerCount = 0;
51
52 public static void main(String[] args) throws Exception {
53 if (args[0].equals("AnonymousLogger")) {
54 System.out.println("Test for WeakReference leak in AnonymousLogger object");
55 testIfLeaking(TestLoggerWeakRefLeak::callAnonymousLogger);
56 } else {
57 System.out.println("Test for WeakReference leak in Logger object");
58 testIfLeaking(TestLoggerWeakRefLeak::callLogger);
59 }
60 }
61
62 /**
|