< prev index next >

test/java/rmi/activation/Activatable/shutdownGracefully/ShutdownGracefully.java

Print this page

        

@@ -20,11 +20,11 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
 
 /* @test
- * @bug 4183169 8032050
+ * @bug 4183169 8032050 8085192
  * @summary Minor problem with the way ReliableLog handles IOExceptions.
  *
  * @author Laird Dornin; code borrowed from Ann Wollrath
  *
  * @library ../../../testlibrary

@@ -35,10 +35,11 @@
  * @build TestLibrary RMID
  *     TestSecurityManager RegisteringActivatable ShutdownGracefully_Stub
  * @run main/othervm/policy=security.policy/timeout=700 ShutdownGracefully
  */
 
+import java.net.BindException;
 import java.rmi.activation.*;
 import java.rmi.*;
 import java.util.Properties;
 import java.util.concurrent.TimeoutException;
 

@@ -72,10 +73,11 @@
 
         try {
             TestLibrary.suggestSecurityManager(
                 "java.rmi.RMISecurityManager");
 
+            for (int i = 0; i < 20; i++) {
             // start an rmid.
             RMID.removeLog();
             rmid = RMID.createRMID();
 
             // rmid needs to run with a security manager that

@@ -86,11 +88,19 @@
                 "-Dsun.rmi.activation.snapshotInterval=1"});
 
             //      rmid.addArguments(new String[] {
             //          "-C-Djava.rmi.server.logCalls=true"});
 
+                try {
             rmid.start();
+                    break;
+                } catch (BindException ex) {
+                    System.err.format("%ncatch BindException(%s), "
+                            + "continue to launch rmid again...%n%n", ex.getMessage());
+                    continue;
+                }
+            }
 
             // Ensure that activation groups run with the correct
             // security manager.
             //
             Properties p = new Properties();
< prev index next >