8066835: TEST_BUG: javax/management/remote/mandatory/connection/RMIConnector_NPETest.java fails

Reviewed-by: lancea
This commit is contained in:
Stuart Marks 2014-12-08 14:32:31 -08:00
parent 277a0d2dc8
commit b633764a63
3 changed files with 20 additions and 3 deletions

View File

@ -194,7 +194,7 @@ public class JavaVM {
throws InterruptedException, TimeoutException {
if (vm == null)
throw new IllegalStateException("can't wait for JavaVM that isn't running");
long deadline = System.currentTimeMillis() + timeout;
long deadline = computeDeadline(System.currentTimeMillis(), timeout);
while (true) {
try {
@ -218,4 +218,21 @@ public class JavaVM {
start();
return waitFor();
}
/**
* Computes a deadline from a timestamp and a timeout value.
* Maximum timeout (before multipliers are applied) is one hour.
*/
public static long computeDeadline(long timestamp, long timeout) {
final long MAX_TIMEOUT_MS = 3_600_000L;
if (timeout < 0L || timeout > MAX_TIMEOUT_MS) {
throw new IllegalArgumentException("timeout " + timeout + "ms out of range");
}
// TODO apply test.timeout.factor (and possibly jcov.sleep.multiplier)
// here instead of upstream
return timestamp + timeout;
}
}

View File

@ -257,7 +257,7 @@ public class RMID extends JavaVM {
waitTime = waitTime * slopFactor;
long startTime = System.currentTimeMillis();
long deadline = startTime + waitTime;
long deadline = computeDeadline(startTime, waitTime);
while (true) {
try {

View File

@ -38,7 +38,7 @@ import javax.management.remote.rmi.*;
public class RMIConnector_NPETest {
public static void main(String argv[]) throws Exception {
RMID rmid = RMID.createRMID();
rmid.start(Long.MAX_VALUE);
rmid.start();
int rmidPort = rmid.getPort();
Exception failureCause = null;
RMIConnector agent = null;