8057149: sun/management/jmxremote/startstop/JMXStartStopTest.java fails with "Starting agent on port ... should report port in use"
Reviewed-by: sla
This commit is contained in:
parent
d6f69e8da5
commit
2d52d7e64d
@ -614,6 +614,9 @@ public class JMXStartStopTest {
|
|||||||
try (ServerSocket ss = new ServerSocket(0))
|
try (ServerSocket ss = new ServerSocket(0))
|
||||||
{
|
{
|
||||||
busyPort = ss.getLocalPort();
|
busyPort = ss.getLocalPort();
|
||||||
|
int retryCntr = 1;
|
||||||
|
do {
|
||||||
|
final boolean[] retry = new boolean[]{false};
|
||||||
jcmd(
|
jcmd(
|
||||||
line -> {
|
line -> {
|
||||||
boolean match = line.contains("Port already in use: " +
|
boolean match = line.contains("Port already in use: " +
|
||||||
@ -621,13 +624,24 @@ public class JMXStartStopTest {
|
|||||||
System.out.println("[match] " + line + " => " + match);
|
System.out.println("[match] " + line + " => " + match);
|
||||||
if (match) {
|
if (match) {
|
||||||
checks.getAndUpdate((op) -> op | 4);
|
checks.getAndUpdate((op) -> op | 4);
|
||||||
|
retry[0] = false;
|
||||||
|
} else if (line.contains("Exception thrown by the agent")) {
|
||||||
|
retry[0] = true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
CMD_START,
|
CMD_START,
|
||||||
"jmxremote.port=" + ss.getLocalPort(),
|
"jmxremote.port=" + ss.getLocalPort(),
|
||||||
"jmxremote.rmi.port=" + pa.getPort2(),
|
"jmxremote.rmi.port=" + pa.getPort2(),
|
||||||
"jmxremote.authenticate=false",
|
"jmxremote.authenticate=false",
|
||||||
"jmxremote.ssl=false");
|
"jmxremote.ssl=false"
|
||||||
|
);
|
||||||
|
if (!retry[0]) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
System.out.println("Attempt " + retryCntr + " >>>");
|
||||||
|
System.out.println("Unexpected reply from the agent. Retrying in 500ms ...");
|
||||||
|
Thread.sleep(500);
|
||||||
|
} while (retryCntr++ < 10);
|
||||||
}
|
}
|
||||||
if ((checks.get() & 1) == 0) {
|
if ((checks.get() & 1) == 0) {
|
||||||
throw new Exception("Starting agent on port " + pa.getPort1() + " should " +
|
throw new Exception("Starting agent on port " + pa.getPort1() + " should " +
|
||||||
|
Loading…
x
Reference in New Issue
Block a user