43 import java.util.function.Consumer;
44 import java.util.stream.Collectors;
45
46 import javax.management.*;
47 import javax.management.remote.*;
48 import javax.net.ssl.SSLHandshakeException;
49
50 import jdk.testlibrary.ProcessTools;
51 import jdk.testlibrary.JDKToolLauncher;
52 import sun.management.Agent;
53 import sun.management.AgentConfigurationError;
54
55 /**
56 * @test
57 * @bug 7110104
58 * @library /lib/testlibrary
59 * @build jdk.testlibrary.* JMXStartStopTest JMXStartStopDoSomething
60 * @run main/othervm/timeout=600 -XX:+UsePerfData JMXStartStopTest
61 * @summary Makes sure that enabling/disabling the management agent through JCMD
62 * achieves the desired results
63 */
64 public class JMXStartStopTest {
65
66 private static final String TEST_SRC = System.getProperty("test.src");
67
68 private static final boolean verbose = false;
69
70 /**
71 * Dynamically allocates distinct ports from the ephemeral range 49152-65535
72 */
73 private static class PortAllocator {
74
75 private final static int LOWER_BOUND = 49152;
76 private final static int UPPER_BOUND = 65535;
77
78 private final static Random RND = new Random(System.currentTimeMillis());
79
80 private static int[] allocatePorts(final int numPorts) {
81 int[] ports = new int[numPorts];
82 for (int i = 0; i < numPorts; i++) {
|
43 import java.util.function.Consumer;
44 import java.util.stream.Collectors;
45
46 import javax.management.*;
47 import javax.management.remote.*;
48 import javax.net.ssl.SSLHandshakeException;
49
50 import jdk.testlibrary.ProcessTools;
51 import jdk.testlibrary.JDKToolLauncher;
52 import sun.management.Agent;
53 import sun.management.AgentConfigurationError;
54
55 /**
56 * @test
57 * @bug 7110104
58 * @library /lib/testlibrary
59 * @build jdk.testlibrary.* JMXStartStopTest JMXStartStopDoSomething
60 * @run main/othervm/timeout=600 -XX:+UsePerfData JMXStartStopTest
61 * @summary Makes sure that enabling/disabling the management agent through JCMD
62 * achieves the desired results
63 * @key randomness
64 */
65 public class JMXStartStopTest {
66
67 private static final String TEST_SRC = System.getProperty("test.src");
68
69 private static final boolean verbose = false;
70
71 /**
72 * Dynamically allocates distinct ports from the ephemeral range 49152-65535
73 */
74 private static class PortAllocator {
75
76 private final static int LOWER_BOUND = 49152;
77 private final static int UPPER_BOUND = 65535;
78
79 private final static Random RND = new Random(System.currentTimeMillis());
80
81 private static int[] allocatePorts(final int numPorts) {
82 int[] ports = new int[numPorts];
83 for (int i = 0; i < numPorts; i++) {
|