# HG changeset patch # User smarks # Date 1418077951 28800 # Node ID 4ed49775c2376acd0fe33fa773b1ddc3e7592397 # Parent b43cb0ec4975a4fd0c677a33583bc8fd054a3fc8 8066835: TEST_BUG: javax/management/remote/mandatory/connection/RMIConnector_NPETest.java fails Reviewed-by: lancea diff -r b43cb0ec4975 -r 4ed49775c237 jdk/test/java/rmi/testlibrary/JavaVM.java --- a/jdk/test/java/rmi/testlibrary/JavaVM.java Mon Dec 08 11:54:17 2014 -0800 +++ b/jdk/test/java/rmi/testlibrary/JavaVM.java Mon Dec 08 14:32:31 2014 -0800 @@ -194,7 +194,7 @@ 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 @@ 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; + } } diff -r b43cb0ec4975 -r 4ed49775c237 jdk/test/java/rmi/testlibrary/RMID.java --- a/jdk/test/java/rmi/testlibrary/RMID.java Mon Dec 08 11:54:17 2014 -0800 +++ b/jdk/test/java/rmi/testlibrary/RMID.java Mon Dec 08 14:32:31 2014 -0800 @@ -257,7 +257,7 @@ waitTime = waitTime * slopFactor; long startTime = System.currentTimeMillis(); - long deadline = startTime + waitTime; + long deadline = computeDeadline(startTime, waitTime); while (true) { try { diff -r b43cb0ec4975 -r 4ed49775c237 jdk/test/javax/management/remote/mandatory/connection/RMIConnector_NPETest.java --- a/jdk/test/javax/management/remote/mandatory/connection/RMIConnector_NPETest.java Mon Dec 08 11:54:17 2014 -0800 +++ b/jdk/test/javax/management/remote/mandatory/connection/RMIConnector_NPETest.java Mon Dec 08 14:32:31 2014 -0800 @@ -38,7 +38,7 @@ 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;