8171076: improve rmi tests by replacing TestLibrary.createRegistryOnUnusedPort, getUnusedRandomPort
authormli
Tue, 13 Dec 2016 18:47:23 -0800
changeset 42686 a907a774b802
parent 42685 a538ed225637
child 42687 7a5929518e6a
8171076: improve rmi tests by replacing TestLibrary.createRegistryOnUnusedPort, getUnusedRandomPort Reviewed-by: rriggs
jdk/test/java/rmi/Naming/LookupNameWithColon.java
jdk/test/java/rmi/Naming/RmiIsNoScheme.java
jdk/test/java/rmi/Naming/UnderscoreHost.java
jdk/test/java/rmi/activation/ActivationSystem/stubClassesPermitted/StubClassesPermitted.java
jdk/test/java/rmi/registry/emptyName/EmptyName.java
jdk/test/java/rmi/reliability/juicer/AppleUserImpl.java
jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/UseCustomSocketFactory.java
jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/security.policy
jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/registry/UseCustomSocketFactory.java
jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/registry/security.policy
jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/unicast/UseCustomSocketFactory.java
jdk/test/java/rmi/server/UnicastRemoteObject/keepAliveDuringCall/KeepAliveDuringCall.java
jdk/test/java/rmi/server/UnicastRemoteObject/unexportObject/UnexportLeak.java
jdk/test/java/rmi/server/Unreferenced/finiteGCLatency/FiniteGCLatency.java
jdk/test/java/rmi/server/Unreferenced/unreferencedContext/UnreferencedContext.java
jdk/test/java/rmi/transport/checkFQDN/CheckFQDN.java
jdk/test/java/rmi/transport/checkLeaseInfoLeak/CheckLeaseLeak.java
jdk/test/java/rmi/transport/rapidExportUnexport/RapidExportUnexport.java
jdk/test/sun/rmi/rmic/newrmic/equivalence/AppleUserImpl.java
jdk/test/sun/rmi/runtime/Log/checkLogging/CheckLogging.java
--- a/jdk/test/java/rmi/Naming/LookupNameWithColon.java	Wed Dec 14 10:41:06 2016 +0800
+++ b/jdk/test/java/rmi/Naming/LookupNameWithColon.java	Tue Dec 13 18:47:23 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, 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
@@ -45,7 +45,7 @@
             "multiple:colons:in:name"
         };
 
-        Registry reg = TestLibrary.createRegistryOnUnusedPort();
+        Registry reg = TestLibrary.createRegistryOnEphemeralPort();
         int port = TestLibrary.getRegistryPort(reg);
 
         for (int i = 0; i < names.length; i++) {
--- a/jdk/test/java/rmi/Naming/RmiIsNoScheme.java	Wed Dec 14 10:41:06 2016 +0800
+++ b/jdk/test/java/rmi/Naming/RmiIsNoScheme.java	Tue Dec 13 18:47:23 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2016, 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
@@ -49,7 +49,7 @@
         System.err.println("\nRegression test for bug 4626311\n");
 
         try {
-            Registry registry = TestLibrary.createRegistryOnUnusedPort();
+            Registry registry = TestLibrary.createRegistryOnEphemeralPort();
             int registryPort = TestLibrary.getRegistryPort(registry);
             Naming.rebind("//:" + registryPort + "/RmiIsNoScheme",
                           new RmiIsNoScheme());
--- a/jdk/test/java/rmi/Naming/UnderscoreHost.java	Wed Dec 14 10:41:06 2016 +0800
+++ b/jdk/test/java/rmi/Naming/UnderscoreHost.java	Tue Dec 13 18:47:23 2016 -0800
@@ -1,5 +1,5 @@
  /*
-  * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+  * Copyright (c) 2005, 2016, 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
@@ -80,7 +80,7 @@
         try {
             HostVerifyingSocketFactory hvf = new HostVerifyingSocketFactory();
             RMISocketFactory.setSocketFactory(hvf);
-            Registry r = TestLibrary.createRegistryOnUnusedPort();
+            Registry r = TestLibrary.createRegistryOnEphemeralPort();
             int port = TestLibrary.getRegistryPort(r);
             t = new UnderscoreHost();
             r.rebind(NAME, t);
--- a/jdk/test/java/rmi/activation/ActivationSystem/stubClassesPermitted/StubClassesPermitted.java	Wed Dec 14 10:41:06 2016 +0800
+++ b/jdk/test/java/rmi/activation/ActivationSystem/stubClassesPermitted/StubClassesPermitted.java	Tue Dec 13 18:47:23 2016 -0800
@@ -85,7 +85,7 @@
         try {
             TestLibrary.suggestSecurityManager("java.lang.SecurityManager");
 
-            registry = TestLibrary.createRegistryOnUnusedPort();
+            registry = TestLibrary.createRegistryOnEphemeralPort();
             registryPort = TestLibrary.getRegistryPort(registry);
 
             // must run with java.lang.SecurityManager or the test
--- a/jdk/test/java/rmi/registry/emptyName/EmptyName.java	Wed Dec 14 10:41:06 2016 +0800
+++ b/jdk/test/java/rmi/registry/emptyName/EmptyName.java	Tue Dec 13 18:47:23 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, 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
@@ -38,7 +38,7 @@
 
 public class EmptyName {
     public static void main(String[] args) throws Exception {
-        Registry impl = TestLibrary.createRegistryOnUnusedPort();
+        Registry impl = TestLibrary.createRegistryOnEphemeralPort();
         Registry stub = (Registry) RemoteObject.toStub(impl);
         stub.bind("", stub);
         stub.lookup("");
--- a/jdk/test/java/rmi/reliability/juicer/AppleUserImpl.java	Wed Dec 14 10:41:06 2016 +0800
+++ b/jdk/test/java/rmi/reliability/juicer/AppleUserImpl.java	Tue Dec 13 18:47:23 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, 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
@@ -313,7 +313,7 @@
 
             synchronized (user) {
                 // create new registry and bind new AppleUserImpl in registry
-                Registry registry = TestLibrary.createRegistryOnUnusedPort();
+                Registry registry = TestLibrary.createRegistryOnEphemeralPort();
                 registryPort = TestLibrary.getRegistryPort(registry);
                 LocateRegistry.getRegistry(registryPort).rebind("AppleUser",
                                                                  user);
--- a/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/UseCustomSocketFactory.java	Wed Dec 14 10:41:06 2016 +0800
+++ b/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/UseCustomSocketFactory.java	Tue Dec 13 18:47:23 2016 -0800
@@ -43,7 +43,7 @@
 import java.rmi.registry.*;
 
 public class UseCustomSocketFactory {
-    static final int REGISTRY_PORT = TestLibrary.getUnusedRandomPort();
+    static int registryPort = -1;
 
     static String[] protocol = new String[] { "", "compress", "xor" };
 
@@ -54,7 +54,8 @@
         TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager");
 
         try {
-            LocateRegistry.createRegistry(REGISTRY_PORT);
+            Registry reg = LocateRegistry.createRegistry(0);
+            registryPort = TestLibrary.getRegistryPort(reg);
         } catch (RemoteException e) {
             TestLibrary.bomb("creating registry", e);
         }
@@ -90,7 +91,7 @@
                                          "-Djava.security.policy=" +
                                          TestParams.defaultPolicy +
                                          " -Drmi.registry.port=" +
-                                         REGISTRY_PORT +
+                                         registryPort +
                                          " -Djava.rmi.activation.port=" +
                                          rmidPort,
                                          protocol[i]);
@@ -108,7 +109,7 @@
                 long stopTime = System.currentTimeMillis() + 24000;
                 do {
                     try {
-                        echo[i] = (Echo) Naming.lookup("//:" + REGISTRY_PORT +
+                        echo[i] = (Echo) Naming.lookup("//:" + registryPort +
                                                        "/EchoServer");
                         break;
                     } catch (NotBoundException e) {
@@ -138,7 +139,7 @@
             } finally {
                 serverVM.destroy();
                 try {
-                    Naming.unbind("//:" + REGISTRY_PORT + "/EchoServer");
+                    Naming.unbind("//:" + registryPort + "/EchoServer");
                 } catch (RemoteException | NotBoundException | MalformedURLException e) {
                     TestLibrary.bomb("unbinding EchoServer", e);
                 }
--- a/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/security.policy	Wed Dec 14 10:41:06 2016 +0800
+++ b/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/security.policy	Tue Dec 13 18:47:23 2016 -0800
@@ -20,6 +20,13 @@
   permission java.util.PropertyPermission "java.security.policy", "read";
   permission java.util.PropertyPermission "java.security.manager", "read";
 
+  // used by TestLibrary to get the RMI Registry port
+  permission java.lang.RuntimePermission "accessClassInPackage.sun.rmi.registry";
+  permission java.lang.RuntimePermission "accessClassInPackage.sun.rmi.server";
+  permission java.lang.RuntimePermission "accessClassInPackage.sun.rmi.transport";
+  permission java.lang.RuntimePermission "accessClassInPackage.sun.rmi.transport.proxy";
+  permission java.lang.RuntimePermission "accessClassInPackage.sun.rmi.transport.tcp";
+
   // used by TestLibrary to determine test environment 
   permission java.util.PropertyPermission "test.*", "read";
   permission java.util.PropertyPermission "user.dir", "read";
--- a/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/registry/UseCustomSocketFactory.java	Wed Dec 14 10:41:06 2016 +0800
+++ b/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/registry/UseCustomSocketFactory.java	Tue Dec 13 18:47:23 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2016, 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
@@ -58,7 +58,7 @@
         System.out.println("\nRegression test for bug 4148850\n");
 
         TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager");
-        int registryPort = TestLibrary.getUnusedRandomPort();
+        int registryPort = -1;
 
         try {
             impl = new HelloImpl();
@@ -68,9 +68,10 @@
              * allow the rmiregistry to be secure.
              */
             registry = LocateRegistry.
-                createRegistry(registryPort,
+                createRegistry(0,
                                new Compress.CompressRMIClientSocketFactory(),
                                new Compress.CompressRMIServerSocketFactory());
+            registryPort = TestLibrary.getRegistryPort(registry);
             registry.rebind("/HelloServer", impl);
             checkStub(registry, "RMIServerSocket");
 
--- a/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/registry/security.policy	Wed Dec 14 10:41:06 2016 +0800
+++ b/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/registry/security.policy	Tue Dec 13 18:47:23 2016 -0800
@@ -22,6 +22,13 @@
   permission java.util.PropertyPermission "java.security.policy", "read";
   permission java.util.PropertyPermission "java.security.manager", "read";
 
+  // used by TestLibrary to get the RMI Registry port
+  permission java.lang.RuntimePermission "accessClassInPackage.sun.rmi.registry";
+  permission java.lang.RuntimePermission "accessClassInPackage.sun.rmi.server";
+  permission java.lang.RuntimePermission "accessClassInPackage.sun.rmi.transport";
+  permission java.lang.RuntimePermission "accessClassInPackage.sun.rmi.transport.proxy";
+  permission java.lang.RuntimePermission "accessClassInPackage.sun.rmi.transport.tcp";
+
   // test needs to export rmid and communicate with objects on arbitrary ports
   permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
 };
--- a/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/unicast/UseCustomSocketFactory.java	Wed Dec 14 10:41:06 2016 +0800
+++ b/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/unicast/UseCustomSocketFactory.java	Tue Dec 13 18:47:23 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2016, 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
@@ -55,7 +55,7 @@
         TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager");
 
         try {
-            Registry registry = TestLibrary.createRegistryOnUnusedPort();
+            Registry registry = TestLibrary.createRegistryOnEphemeralPort();
             registryPort = TestLibrary.getRegistryPort(registry);
         } catch (RemoteException e) {
             TestLibrary.bomb("creating registry", e);
--- a/jdk/test/java/rmi/server/UnicastRemoteObject/keepAliveDuringCall/KeepAliveDuringCall.java	Wed Dec 14 10:41:06 2016 +0800
+++ b/jdk/test/java/rmi/server/UnicastRemoteObject/keepAliveDuringCall/KeepAliveDuringCall.java	Tue Dec 13 18:47:23 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, 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
@@ -80,7 +80,7 @@
             UnicastRemoteObject.exportObject(obj);
             System.err.println("exported shutdown monitor");
 
-            Registry localRegistry = TestLibrary.createRegistryOnUnusedPort();
+            Registry localRegistry = TestLibrary.createRegistryOnEphemeralPort();
             int registryPort = TestLibrary.getRegistryPort(localRegistry);
             System.err.println("created local registry");
 
--- a/jdk/test/java/rmi/server/UnicastRemoteObject/unexportObject/UnexportLeak.java	Wed Dec 14 10:41:06 2016 +0800
+++ b/jdk/test/java/rmi/server/UnicastRemoteObject/unexportObject/UnexportLeak.java	Tue Dec 13 18:47:23 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, 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
@@ -49,7 +49,7 @@
     public static void main(String[] args) {
         try {
             System.err.println("\nRegression test for bug 4331349\n");
-            Registry registry = TestLibrary.createRegistryOnUnusedPort();
+            Registry registry = TestLibrary.createRegistryOnEphemeralPort();
             int registryPort = TestLibrary.getRegistryPort(registry);
             Remote obj = new UnexportLeak();
             WeakReference wr = new WeakReference(obj);
--- a/jdk/test/java/rmi/server/Unreferenced/finiteGCLatency/FiniteGCLatency.java	Wed Dec 14 10:41:06 2016 +0800
+++ b/jdk/test/java/rmi/server/Unreferenced/finiteGCLatency/FiniteGCLatency.java	Tue Dec 13 18:47:23 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2016, 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
@@ -81,7 +81,7 @@
         try {
             UnicastRemoteObject.exportObject(obj);
             System.err.println("exported remote object");
-            Registry registry1 = TestLibrary.createRegistryOnUnusedPort();
+            Registry registry1 = TestLibrary.createRegistryOnEphemeralPort();
             int port = TestLibrary.getRegistryPort(registry1);
             System.err.println("created registry");
 
--- a/jdk/test/java/rmi/server/Unreferenced/unreferencedContext/UnreferencedContext.java	Wed Dec 14 10:41:06 2016 +0800
+++ b/jdk/test/java/rmi/server/Unreferenced/unreferencedContext/UnreferencedContext.java	Tue Dec 13 18:47:23 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2016, 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
@@ -122,7 +122,7 @@
             UnicastRemoteObject.exportObject(obj);
             System.err.println("exported remote object");
 
-            Registry registry1 = TestLibrary.createRegistryOnUnusedPort();
+            Registry registry1 = TestLibrary.createRegistryOnEphemeralPort();
             int port = TestLibrary.getRegistryPort(registry1);
             System.err.println("created registry");
 
--- a/jdk/test/java/rmi/transport/checkFQDN/CheckFQDN.java	Wed Dec 14 10:41:06 2016 +0800
+++ b/jdk/test/java/rmi/transport/checkFQDN/CheckFQDN.java	Tue Dec 13 18:47:23 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2016, 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
@@ -81,7 +81,7 @@
             System.err.println
                 ("\nRegression test for bug/rfe 4115683\n");
 
-            Registry registry = TestLibrary.createRegistryOnUnusedPort();
+            Registry registry = TestLibrary.createRegistryOnEphemeralPort();
             REGISTRY_PORT = TestLibrary.getRegistryPort(registry);
             registry.bind("CheckFQDN", checkFQDN);
 
--- a/jdk/test/java/rmi/transport/checkLeaseInfoLeak/CheckLeaseLeak.java	Wed Dec 14 10:41:06 2016 +0800
+++ b/jdk/test/java/rmi/transport/checkLeaseInfoLeak/CheckLeaseLeak.java	Tue Dec 13 18:47:23 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2016, 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
@@ -30,6 +30,7 @@
  * @library ../../testlibrary
  * @modules java.rmi/sun.rmi.registry
  *          java.rmi/sun.rmi.server
+ *          java.rmi/sun.rmi.transport:open
  *          java.rmi/sun.rmi.transport
  *          java.rmi/sun.rmi.transport.tcp
  * @build TestLibrary CheckLeaseLeak_Stub LeaseLeakClient LeaseLeak
@@ -90,7 +91,7 @@
 
         try {
             Registry registry =
-                TestLibrary.createRegistryOnUnusedPort();
+                TestLibrary.createRegistryOnEphemeralPort();
             int registryPort = TestLibrary.getRegistryPort(registry);
 
             leakServer = new CheckLeaseLeak();
--- a/jdk/test/java/rmi/transport/rapidExportUnexport/RapidExportUnexport.java	Wed Dec 14 10:41:06 2016 +0800
+++ b/jdk/test/java/rmi/transport/rapidExportUnexport/RapidExportUnexport.java	Tue Dec 13 18:47:23 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, 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
@@ -44,7 +44,6 @@
 import java.rmi.server.UnicastRemoteObject;
 
 public class RapidExportUnexport {
-    private static final int PORT = TestLibrary.getUnusedRandomPort();
     private static final int REPS = 100;
     private static final long TIMEOUT = 60000;
 
@@ -55,7 +54,7 @@
         long start = System.currentTimeMillis();
         for (int i = 0; i < REPS; i++) {
             System.err.println(i);
-            UnicastRemoteObject.exportObject(impl, PORT);
+            UnicastRemoteObject.exportObject(impl, 0);
             UnicastRemoteObject.unexportObject(impl, true);
             Thread.sleep(1);    // work around BindException (bug?)
         }
--- a/jdk/test/sun/rmi/rmic/newrmic/equivalence/AppleUserImpl.java	Wed Dec 14 10:41:06 2016 +0800
+++ b/jdk/test/sun/rmi/rmic/newrmic/equivalence/AppleUserImpl.java	Tue Dec 13 18:47:23 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, 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
@@ -253,7 +253,7 @@
             int port = -1;
             // create new registry and bind new AppleUserImpl in registry
             try {
-                Registry registry = TestLibrary.createRegistryOnUnusedPort();
+                Registry registry = TestLibrary.createRegistryOnEphemeralPort();
                 port = TestLibrary.getRegistryPort(registry);
                 Naming.rebind("rmi://localhost:" + port + "/AppleUser",user);
             } catch (RemoteException e) {
--- a/jdk/test/sun/rmi/runtime/Log/checkLogging/CheckLogging.java	Wed Dec 14 10:41:06 2016 +0800
+++ b/jdk/test/sun/rmi/runtime/Log/checkLogging/CheckLogging.java	Tue Dec 13 18:47:23 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, 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
@@ -103,7 +103,7 @@
     private static Registry registry;
     static {
         try {
-            registry = TestLibrary.createRegistryOnUnusedPort();
+            registry = TestLibrary.createRegistryOnEphemeralPort();
             REGISTRY_PORT = TestLibrary.getRegistryPort(registry);
             LOCATION = "rmi://localhost:" + REGISTRY_PORT + "/";
         } catch (Exception e) {