8314476: TestJstatdPortAndServer.java failed with "java.rmi.NoSuchObjectException: no such object in table"
Reviewed-by: msheppar, sspitsyn
This commit is contained in:
parent
93188bd80c
commit
1d0250709a
@ -65,6 +65,8 @@ public final class JstatdTest {
|
||||
private static final int JSTAT_GCUTIL_INTERVAL_MS = 250;
|
||||
private static final String JPS_OUTPUT_REGEX = "^\\d+\\s*.*";
|
||||
|
||||
private static final int MAX_JSTATD_TRIES = 10;
|
||||
|
||||
private boolean useDefaultPort = true;
|
||||
private boolean useDefaultRmiPort = true;
|
||||
private String port;
|
||||
@ -282,7 +284,7 @@ public final class JstatdTest {
|
||||
private ProcessThread tryToSetupJstatdProcess() throws Throwable {
|
||||
portInUse = false;
|
||||
ProcessThread jstatdThread = new ProcessThread("Jstatd-Thread",
|
||||
JstatdTest::isJstadReady, getJstatdCmd());
|
||||
JstatdTest::isJstatdReady, getJstatdCmd());
|
||||
try {
|
||||
jstatdThread.start();
|
||||
// Make sure jstatd is up and running
|
||||
@ -302,8 +304,8 @@ public final class JstatdTest {
|
||||
return jstatdThread;
|
||||
}
|
||||
|
||||
private static boolean isJstadReady(String line) {
|
||||
if (line.contains("Port already in use")) {
|
||||
private static boolean isJstatdReady(String line) {
|
||||
if (line.contains("Port already in use") || line.contains("Could not bind")) {
|
||||
portInUse = true;
|
||||
return true;
|
||||
}
|
||||
@ -322,8 +324,9 @@ public final class JstatdTest {
|
||||
}
|
||||
|
||||
ProcessThread jstatdThread = null;
|
||||
int tries = 0;
|
||||
try {
|
||||
while (jstatdThread == null) {
|
||||
while (jstatdThread == null && ++tries <= MAX_JSTATD_TRIES) {
|
||||
if (!useDefaultPort) {
|
||||
port = String.valueOf(Utils.getFreePort());
|
||||
}
|
||||
@ -339,10 +342,11 @@ public final class JstatdTest {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
jstatdThread = tryToSetupJstatdProcess();
|
||||
}
|
||||
|
||||
if (jstatdThread == null) {
|
||||
throw new RuntimeException("Cannot start jstatd.");
|
||||
}
|
||||
runToolsAndVerify();
|
||||
} finally {
|
||||
cleanUpThread(jstatdThread);
|
||||
|
Loading…
x
Reference in New Issue
Block a user