8067316: TEST_BUG: update RMI test library with better test.timeout.factor handling
authorsmarks
Tue, 23 Dec 2014 16:58:06 -0800
changeset 28294 d53052d43e13
parent 28293 ad51f784a352
child 28295 f45d65db7a17
8067316: TEST_BUG: update RMI test library with better test.timeout.factor handling Reviewed-by: lancea
jdk/test/java/rmi/activation/Activatable/checkActivateRef/group.security.policy
jdk/test/java/rmi/activation/Activatable/checkAnnotations/group.security.policy
jdk/test/java/rmi/activation/Activatable/checkRegisterInLog/group.security.policy
jdk/test/java/rmi/activation/Activatable/createPrivateActivable/group.security.policy
jdk/test/java/rmi/activation/Activatable/downloadParameterClass/group.security.policy
jdk/test/java/rmi/activation/Activatable/elucidateNoSuchMethod/group.security.policy
jdk/test/java/rmi/activation/Activatable/extLoadedImpl/group.security.policy
jdk/test/java/rmi/activation/Activatable/forceLogSnapshot/group.security.policy
jdk/test/java/rmi/activation/Activatable/inactiveGroup/group.security.policy
jdk/test/java/rmi/activation/Activatable/nestedActivate/group.security.policy
jdk/test/java/rmi/activation/Activatable/nonExistentActivatable/group.security.policy
jdk/test/java/rmi/activation/Activatable/restartCrashedService/group.security.policy
jdk/test/java/rmi/activation/Activatable/restartLatecomer/group.security.policy
jdk/test/java/rmi/activation/Activatable/restartService/group.security.policy
jdk/test/java/rmi/activation/Activatable/shutdownGracefully/group.security.policy
jdk/test/java/rmi/activation/Activatable/unregisterInactive/group.security.policy
jdk/test/java/rmi/activation/ActivateFailedException/activateFails/group.security.policy
jdk/test/java/rmi/activation/ActivationGroup/downloadActivationGroup/group.security.policy
jdk/test/java/rmi/activation/ActivationSystem/modifyDescriptor/group.security.policy
jdk/test/java/rmi/activation/ActivationSystem/stubClassesPermitted/group.security.policy
jdk/test/java/rmi/activation/ActivationSystem/unregisterGroup/group.security.policy
jdk/test/java/rmi/activation/CommandEnvironment/group.security.policy
jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/group.security.policy
jdk/test/java/rmi/server/RemoteServer/setLogPermission/SetLogPermission.java
jdk/test/java/rmi/server/RemoteServer/setLogPermission/java.policy
jdk/test/java/rmi/server/RemoteServer/setLogPermission/security.policy
jdk/test/java/rmi/testlibrary/ActivationLibrary.java
jdk/test/java/rmi/testlibrary/JavaVM.java
jdk/test/java/rmi/testlibrary/RMID.java
jdk/test/java/rmi/testlibrary/TestLibrary.java
--- a/jdk/test/java/rmi/activation/Activatable/checkActivateRef/group.security.policy	Mon Jan 05 21:52:03 2015 +0530
+++ b/jdk/test/java/rmi/activation/Activatable/checkActivateRef/group.security.policy	Tue Dec 23 16:58:06 2014 -0800
@@ -4,8 +4,8 @@
 
 grant {
   permission java.io.FilePermission "..${/}..${/}test.props", "read";
+  permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
+  permission java.util.PropertyPermission "test.*", "read";
 
-  // test needs to communicate with the activation system
-  permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
   permission java.lang.RuntimePermission "getClassLoader";
 };
--- a/jdk/test/java/rmi/activation/Activatable/checkAnnotations/group.security.policy	Mon Jan 05 21:52:03 2015 +0530
+++ b/jdk/test/java/rmi/activation/Activatable/checkAnnotations/group.security.policy	Tue Dec 23 16:58:06 2014 -0800
@@ -1,10 +1,9 @@
 /*
- * security policy used by activation groups.
+ * security policy used by activation groups
  */
 
 grant {
   permission java.io.FilePermission "..${/}..${/}test.props", "read";
-
-  // test needs to communicate with the activation system
   permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
+  permission java.util.PropertyPermission "test.*", "read";
 };
--- a/jdk/test/java/rmi/activation/Activatable/checkRegisterInLog/group.security.policy	Mon Jan 05 21:52:03 2015 +0530
+++ b/jdk/test/java/rmi/activation/Activatable/checkRegisterInLog/group.security.policy	Tue Dec 23 16:58:06 2014 -0800
@@ -4,10 +4,6 @@
 
 grant {
   permission java.io.FilePermission "..${/}..${/}test.props", "read";
-
-  // allow remote objects to be exported on arbitrary ports.
-  permission java.net.SocketPermission "*:1024-", "connect,accept";
-
-  // allow exporting object with non-public remote interface
-  permission java.rmi.RMIPermission "exportRemoteInterface.ActivateMe";
+  permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
+  permission java.util.PropertyPermission "test.*", "read";
 };
--- a/jdk/test/java/rmi/activation/Activatable/createPrivateActivable/group.security.policy	Mon Jan 05 21:52:03 2015 +0530
+++ b/jdk/test/java/rmi/activation/Activatable/createPrivateActivable/group.security.policy	Tue Dec 23 16:58:06 2014 -0800
@@ -1,13 +1,9 @@
 /*
- * security policy used activation groups
+ * security policy used by activation groups
  */
 
 grant {
   permission java.io.FilePermission "..${/}..${/}test.props", "read";
-
-  // test needs to communicate with the activation system
   permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
-
-  // allow exporting object with non-public remote interface
-  permission java.rmi.RMIPermission "exportRemoteInterface.ActivateMe";
+  permission java.util.PropertyPermission "test.*", "read";
 };
--- a/jdk/test/java/rmi/activation/Activatable/downloadParameterClass/group.security.policy	Mon Jan 05 21:52:03 2015 +0530
+++ b/jdk/test/java/rmi/activation/Activatable/downloadParameterClass/group.security.policy	Tue Dec 23 16:58:06 2014 -0800
@@ -1,14 +1,15 @@
 /*
- * security policy used exec'ed activation groups
+ * security policy used by activation groups
  */
 
 grant {
+  permission java.io.FilePermission "..${/}..${/}test.props", "read";
+  permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
+  permission java.util.PropertyPermission "test.*", "read";
+
   // need to load custom security manager and activation group from a new codebase
   permission java.io.FilePermission ".${/}codebase1", "read,write,delete";
   permission java.io.FilePermission ".${/}codebase1${/}-", "read,write";
   permission java.io.FilePermission ".${/}codebase2", "read,write,delete";
   permission java.io.FilePermission ".${/}codebase2${/}-", "read,write,delete";
-
-  // allow remote objects to be exported on arbitrary ports.
-  permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
 };
--- a/jdk/test/java/rmi/activation/Activatable/elucidateNoSuchMethod/group.security.policy	Mon Jan 05 21:52:03 2015 +0530
+++ b/jdk/test/java/rmi/activation/Activatable/elucidateNoSuchMethod/group.security.policy	Tue Dec 23 16:58:06 2014 -0800
@@ -1,12 +1,13 @@
 /*
- * security policy used activation groups
+ * security policy used by activation groups
  */
 
 grant {
+  permission java.io.FilePermission "..${/}..${/}test.props", "read";
+  permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
+  permission java.util.PropertyPermission "test.*", "read";
+
   // Needed because of bug#: 4182104
   permission java.lang.RuntimePermission "modifyThreadGroup";
   permission java.lang.RuntimePermission "modifyThread";
-
-  // allow remote objects to be exported on arbitrary ports.
-  permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
 };
--- a/jdk/test/java/rmi/activation/Activatable/extLoadedImpl/group.security.policy	Mon Jan 05 21:52:03 2015 +0530
+++ b/jdk/test/java/rmi/activation/Activatable/extLoadedImpl/group.security.policy	Tue Dec 23 16:58:06 2014 -0800
@@ -1,8 +1,9 @@
 /*
- * security policy used exec'ed activation groups
+ * security policy used by activation groups
  */
 
 grant {
-  // allow remote objects to be exported on arbitrary ports.
+  permission java.io.FilePermission "..${/}..${/}test.props", "read";
   permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
+  permission java.util.PropertyPermission "test.*", "read";
 };
--- a/jdk/test/java/rmi/activation/Activatable/forceLogSnapshot/group.security.policy	Mon Jan 05 21:52:03 2015 +0530
+++ b/jdk/test/java/rmi/activation/Activatable/forceLogSnapshot/group.security.policy	Tue Dec 23 16:58:06 2014 -0800
@@ -3,9 +3,7 @@
  */
 
 grant {
-  // allow remote objects to be exported on arbitrary ports.
+  permission java.io.FilePermission "..${/}..${/}test.props", "read";
   permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
-
-  // allow exporting object with non-public remote interface
-  permission java.rmi.RMIPermission "exportRemoteInterface.ActivateMe";
+  permission java.util.PropertyPermission "test.*", "read";
 };
--- a/jdk/test/java/rmi/activation/Activatable/inactiveGroup/group.security.policy	Mon Jan 05 21:52:03 2015 +0530
+++ b/jdk/test/java/rmi/activation/Activatable/inactiveGroup/group.security.policy	Tue Dec 23 16:58:06 2014 -0800
@@ -4,10 +4,6 @@
 
 grant {
   permission java.io.FilePermission "..${/}..${/}test.props", "read";
-
-  // allow remote objects to be exported on arbitrary ports.
   permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
-
-  // allow exporting object with non-public remote interface
-  permission java.rmi.RMIPermission "exportRemoteInterface.ActivateMe";
+  permission java.util.PropertyPermission "test.*", "read";
 };
--- a/jdk/test/java/rmi/activation/Activatable/nestedActivate/group.security.policy	Mon Jan 05 21:52:03 2015 +0530
+++ b/jdk/test/java/rmi/activation/Activatable/nestedActivate/group.security.policy	Tue Dec 23 16:58:06 2014 -0800
@@ -1,13 +1,9 @@
 /*
- * security policy used by test activation groups
+ * security policy used by activation groups
  */
 
 grant {
   permission java.io.FilePermission "..${/}..${/}test.props", "read";
-
-  // allow remote objects to be exported on arbitrary ports.
   permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
-
-  // allow exporting of non-public remote interface
-  permission java.rmi.RMIPermission "exportRemoteInterface.ActivateMe";
+  permission java.util.PropertyPermission "test.*", "read";
 };
--- a/jdk/test/java/rmi/activation/Activatable/nonExistentActivatable/group.security.policy	Mon Jan 05 21:52:03 2015 +0530
+++ b/jdk/test/java/rmi/activation/Activatable/nonExistentActivatable/group.security.policy	Tue Dec 23 16:58:06 2014 -0800
@@ -4,7 +4,6 @@
 
 grant {
   permission java.io.FilePermission "..${/}..${/}test.props", "read";
-
-  // allow remote objects to be exported on arbitrary ports.
   permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
+  permission java.util.PropertyPermission "test.*", "read";
 };
--- a/jdk/test/java/rmi/activation/Activatable/restartCrashedService/group.security.policy	Mon Jan 05 21:52:03 2015 +0530
+++ b/jdk/test/java/rmi/activation/Activatable/restartCrashedService/group.security.policy	Tue Dec 23 16:58:06 2014 -0800
@@ -1,8 +1,9 @@
 /*
- * security policy used by test activation groups
+ * security policy used by activation groups
  */
 
 grant {
-  // test needs to communicate with the activation system
+  permission java.io.FilePermission "..${/}..${/}test.props", "read";
   permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
+  permission java.util.PropertyPermission "test.*", "read";
 };
--- a/jdk/test/java/rmi/activation/Activatable/restartLatecomer/group.security.policy	Mon Jan 05 21:52:03 2015 +0530
+++ b/jdk/test/java/rmi/activation/Activatable/restartLatecomer/group.security.policy	Tue Dec 23 16:58:06 2014 -0800
@@ -3,6 +3,7 @@
  */
 
 grant {
-  // allow remote objects to be exported on arbitrary ports.
+  permission java.io.FilePermission "..${/}..${/}test.props", "read";
   permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
+  permission java.util.PropertyPermission "test.*", "read";
 };
--- a/jdk/test/java/rmi/activation/Activatable/restartService/group.security.policy	Mon Jan 05 21:52:03 2015 +0530
+++ b/jdk/test/java/rmi/activation/Activatable/restartService/group.security.policy	Tue Dec 23 16:58:06 2014 -0800
@@ -3,6 +3,7 @@
  */
 
 grant {
-  // allow remote objects to be exported on arbitrary ports.
+  permission java.io.FilePermission "..${/}..${/}test.props", "read";
   permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
+  permission java.util.PropertyPermission "test.*", "read";
 };
--- a/jdk/test/java/rmi/activation/Activatable/shutdownGracefully/group.security.policy	Mon Jan 05 21:52:03 2015 +0530
+++ b/jdk/test/java/rmi/activation/Activatable/shutdownGracefully/group.security.policy	Tue Dec 23 16:58:06 2014 -0800
@@ -1,10 +1,9 @@
 /*
- * security policy used activation groups
+ * security policy used by activation groups
  */
 
 grant {
   permission java.io.FilePermission "..${/}..${/}test.props", "read";
-
-  // test needs to communicate with the activation system
   permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
+  permission java.util.PropertyPermission "test.*", "read";
 };
--- a/jdk/test/java/rmi/activation/Activatable/unregisterInactive/group.security.policy	Mon Jan 05 21:52:03 2015 +0530
+++ b/jdk/test/java/rmi/activation/Activatable/unregisterInactive/group.security.policy	Tue Dec 23 16:58:06 2014 -0800
@@ -4,7 +4,6 @@
 
 grant {
   permission java.io.FilePermission "..${/}..${/}test.props", "read";
-
-  // allow remote objects to be exported on arbitrary ports.
   permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
+  permission java.util.PropertyPermission "test.*", "read";
 };
--- a/jdk/test/java/rmi/activation/ActivateFailedException/activateFails/group.security.policy	Mon Jan 05 21:52:03 2015 +0530
+++ b/jdk/test/java/rmi/activation/ActivateFailedException/activateFails/group.security.policy	Tue Dec 23 16:58:06 2014 -0800
@@ -1,8 +1,9 @@
 /*
- * security policy used activation groups
+ * security policy used by activation groups
  */
 
 grant {
-  // test needs to communicate with the activation system
+  permission java.io.FilePermission "..${/}..${/}test.props", "read";
   permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
+  permission java.util.PropertyPermission "test.*", "read";
 };
--- a/jdk/test/java/rmi/activation/ActivationGroup/downloadActivationGroup/group.security.policy	Mon Jan 05 21:52:03 2015 +0530
+++ b/jdk/test/java/rmi/activation/ActivationGroup/downloadActivationGroup/group.security.policy	Tue Dec 23 16:58:06 2014 -0800
@@ -1,10 +1,11 @@
 /*
- * security policy used by downloaded activation group
+ * security policy used by activation groups
  */
 
 grant {
   permission java.io.FilePermission "..${/}..${/}test.props", "read";
+  permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
+  permission java.util.PropertyPermission "test.*", "read";
 
   permission java.lang.RuntimePermission "accessClassInPackage.sun.rmi.server";
-  permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
 };
--- a/jdk/test/java/rmi/activation/ActivationSystem/modifyDescriptor/group.security.policy	Mon Jan 05 21:52:03 2015 +0530
+++ b/jdk/test/java/rmi/activation/ActivationSystem/modifyDescriptor/group.security.policy	Tue Dec 23 16:58:06 2014 -0800
@@ -4,10 +4,6 @@
 
 grant {
   permission java.io.FilePermission "..${/}..${/}test.props", "read";
-
-  // accomodate property used by this test.
-  permission java.util.PropertyPermission "test.message", "read";
-
-  // test needs to communicate with the activation system
   permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
+  permission java.util.PropertyPermission "test.*", "read";
 };
--- a/jdk/test/java/rmi/activation/ActivationSystem/stubClassesPermitted/group.security.policy	Mon Jan 05 21:52:03 2015 +0530
+++ b/jdk/test/java/rmi/activation/ActivationSystem/stubClassesPermitted/group.security.policy	Tue Dec 23 16:58:06 2014 -0800
@@ -1,13 +1,11 @@
 /*
- * security policy used by activation groups.
+ * security policy used by activation groups
  */
 
 grant {
   permission java.io.FilePermission "..${/}..${/}test.props", "read";
-
-  // give the group permission to create a class that the main test process can not create
-  permission java.lang.RuntimePermission "accessClassInPackage.sun.security.provider";
+  permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
+  permission java.util.PropertyPermission "test.*", "read";
 
-  // test needs to communicate with the activation system
-  permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
+  permission java.lang.RuntimePermission "accessClassInPackage.sun.security.provider";
 };
--- a/jdk/test/java/rmi/activation/ActivationSystem/unregisterGroup/group.security.policy	Mon Jan 05 21:52:03 2015 +0530
+++ b/jdk/test/java/rmi/activation/ActivationSystem/unregisterGroup/group.security.policy	Tue Dec 23 16:58:06 2014 -0800
@@ -4,8 +4,6 @@
 
 grant {
   permission java.io.FilePermission "..${/}..${/}test.props", "read";
-
-  // test needs to communicate with the activation system
   permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
-  permission java.util.PropertyPermission "unregisterGroup.port", "read";
+  permission java.util.PropertyPermission "test.*", "read";
 };
--- a/jdk/test/java/rmi/activation/CommandEnvironment/group.security.policy	Mon Jan 05 21:52:03 2015 +0530
+++ b/jdk/test/java/rmi/activation/CommandEnvironment/group.security.policy	Tue Dec 23 16:58:06 2014 -0800
@@ -1,8 +1,9 @@
 /*
- * security policy used by activation groups.
+ * security policy used by activation groups
  */
 
 grant {
-  // test needs to communicate with the activation system
+  permission java.io.FilePermission "..${/}..${/}test.props", "read";
   permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
+  permission java.util.PropertyPermission "test.*", "read";
 };
--- a/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/group.security.policy	Mon Jan 05 21:52:03 2015 +0530
+++ b/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/group.security.policy	Tue Dec 23 16:58:06 2014 -0800
@@ -1,11 +1,9 @@
 /*
- * security policy used by the rmid process exec'ed by a running
- * instance of the test.
+ * security policy used by activation groups
  */
 
 grant {
   permission java.io.FilePermission "..${/}..${/}test.props", "read";
-
-  // test needs to communicate with the activation system
   permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
+  permission java.util.PropertyPermission "test.*", "read";
 };
--- a/jdk/test/java/rmi/server/RemoteServer/setLogPermission/SetLogPermission.java	Mon Jan 05 21:52:03 2015 +0530
+++ b/jdk/test/java/rmi/server/RemoteServer/setLogPermission/SetLogPermission.java	Tue Dec 23 16:58:06 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,7 +27,7 @@
  * The RemoteServer.setLog method requires
  * java.util.log.LoggingPermission("control").
  * @author Ann Wollrath
- * @run main/othervm/policy=java.policy SetLogPermission
+ * @run main/othervm/policy=security.policy SetLogPermission
  */
 
 import java.rmi.server.RemoteServer;
--- a/jdk/test/java/rmi/server/RemoteServer/setLogPermission/java.policy	Mon Jan 05 21:52:03 2015 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-grant {
-    permission java.util.logging.LoggingPermission "control";
-};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/rmi/server/RemoteServer/setLogPermission/security.policy	Tue Dec 23 16:58:06 2014 -0800
@@ -0,0 +1,3 @@
+grant {
+    permission java.util.logging.LoggingPermission "control";
+};
--- a/jdk/test/java/rmi/testlibrary/ActivationLibrary.java	Mon Jan 05 21:52:03 2015 +0530
+++ b/jdk/test/java/rmi/testlibrary/ActivationLibrary.java	Tue Dec 23 16:58:06 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -40,20 +40,6 @@
  * objects.
  */
 public class ActivationLibrary {
-    /** time safeDestroy should wait before failing on shutdown rmid */
-    private static final int SAFE_WAIT_TIME;
-    static {
-        int slopFactor = 1;
-        try {
-            slopFactor = Integer.valueOf(
-                TestLibrary.getExtraProperty("jcov.sleep.multiplier","1"));
-        } catch (NumberFormatException ignore) {}
-        SAFE_WAIT_TIME = 60000 * slopFactor;
-    }
-
-    private static final String SYSTEM_NAME =
-        ActivationSystem.class.getName();
-
     private static void mesg(Object mesg) {
         System.err.println("ACTIVATION_LIBRARY: " + mesg.toString());
     }
@@ -63,20 +49,19 @@
      */
     public static void deactivate(Remote remote,
                                   ActivationID id) {
-        // We do as much as 50 deactivation trials, each separated by
-        // at least 100 milliseconds sleep time (max sleep time of 5 secs).
-        final long deactivateSleepTime = 100;
-        long stopTime = System.currentTimeMillis() + deactivateSleepTime * 50;
-        while (System.currentTimeMillis() < stopTime) {
+        final long POLLTIME_MS = 100L;
+        final long DEACTIVATE_TIME_MS = 30_000L;
+
+        long startTime = System.currentTimeMillis();
+        long deadline = TestLibrary.computeDeadline(startTime, DEACTIVATE_TIME_MS);
+
+        while (System.currentTimeMillis() < deadline) {
             try {
                 if (Activatable.inactive(id) == true) {
                     mesg("inactive successful");
                     return;
                 } else {
-                    mesg("inactive trial failed. Sleeping " +
-                         deactivateSleepTime +
-                         " milliseconds before next trial");
-                    Thread.sleep(deactivateSleepTime);
+                    Thread.sleep(POLLTIME_MS);
                 }
             } catch (InterruptedException e) {
                 Thread.currentThread().interrupt();
@@ -95,7 +80,8 @@
             }
         }
 
-        mesg("unable to inactivate after several attempts");
+        mesg("unable to inactivate after " +
+            (System.currentTimeMillis() - startTime) + "ms.");
         mesg("unexporting object forcibly instead");
 
         try {
--- a/jdk/test/java/rmi/testlibrary/JavaVM.java	Mon Jan 05 21:52:03 2015 +0530
+++ b/jdk/test/java/rmi/testlibrary/JavaVM.java	Tue Dec 23 16:58:06 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -194,7 +194,7 @@
             throws InterruptedException, TimeoutException {
         if (vm == null)
             throw new IllegalStateException("can't wait for JavaVM that isn't running");
-        long deadline = computeDeadline(System.currentTimeMillis(), timeout);
+        long deadline = TestLibrary.computeDeadline(System.currentTimeMillis(), timeout);
 
         while (true) {
             try {
@@ -218,21 +218,4 @@
         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;
-    }
 }
--- a/jdk/test/java/rmi/testlibrary/RMID.java	Mon Jan 05 21:52:03 2015 +0530
+++ b/jdk/test/java/rmi/testlibrary/RMID.java	Tue Dec 23 16:58:06 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -249,15 +249,15 @@
         mesg("Starting rmid on port " + port + ".");
         super.start();
 
-        int slopFactor = 1;
-        try {
-            slopFactor = Integer.valueOf(
-                TestLibrary.getExtraProperty("jcov.sleep.multiplier","1"));
-        } catch (NumberFormatException ignore) {}
-        waitTime = waitTime * slopFactor;
+        // int slopFactor = 1;
+        // try {
+        //     slopFactor = Integer.valueOf(
+        //         TestLibrary.getExtraProperty("jcov.sleep.multiplier","1"));
+        // } catch (NumberFormatException ignore) {}
+        // waitTime = waitTime * slopFactor;
 
         long startTime = System.currentTimeMillis();
-        long deadline = computeDeadline(startTime, waitTime);
+        long deadline = TestLibrary.computeDeadline(startTime, waitTime);
 
         while (true) {
             try {
--- a/jdk/test/java/rmi/testlibrary/TestLibrary.java	Mon Jan 05 21:52:03 2015 +0530
+++ b/jdk/test/java/rmi/testlibrary/TestLibrary.java	Tue Dec 23 16:58:06 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -135,7 +135,8 @@
      */
 
     public static boolean checkIfRegistryRunning(int port, int msTimeout) {
-        long stopTime = System.currentTimeMillis() + msTimeout;
+        final long POLLTIME_MS = 100L;
+        long stopTime = computeDeadline(System.currentTimeMillis(), msTimeout);
         do {
             try {
                 Registry r = LocateRegistry.getRegistry(port);
@@ -145,12 +146,12 @@
             } catch (RemoteException e) {
                 // problem - not ready ? Try again
                 try {
-                    Thread.sleep(500);
+                    Thread.sleep(POLLTIME_MS);
                 } catch (InterruptedException ie) {
                     // not expected
                 }
             }
-        } while (stopTime > System.currentTimeMillis());
+        } while (System.currentTimeMillis() < stopTime);
         return false;
     }
 
@@ -169,6 +170,31 @@
         }
     }
 
+    public static double getTimeoutFactor() {
+        String prop = getProperty("test.timeout.factor", "1.0");
+        double timeoutFactor = 1.0;
+
+        try {
+            timeoutFactor = Double.parseDouble(prop);
+        } catch (NumberFormatException ignore) { }
+
+        return timeoutFactor;
+    }
+
+    /**
+     * 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");
+        }
+
+        return timestamp + (long)(timeout * getTimeoutFactor());
+    }
+
     /**
      * Property mutators
      */