< prev index next >

test/java/rmi/activation/Activatable/forceLogSnapshot/ForceLogSnapshot.java

Print this page

        

@@ -20,11 +20,11 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
 
 /* @test
- * @bug 4173960
+ * @bug 4173960 8085192
  * @summary synopsis: Activatable objects cannot be restarted.
  * @author Laird Dornin
  *
  * @library ../../../testlibrary
  * @modules java.rmi/sun.rmi.registry

@@ -35,10 +35,11 @@
  *     ActivateMe ForceLogSnapshot_Stub
  * @run main/othervm/policy=security.policy/timeout=640 ForceLogSnapshot
  */
 
 import java.io.*;
+import java.net.BindException;
 import java.rmi.*;
 import java.rmi.activation.*;
 import java.rmi.server.*;
 import java.rmi.registry.*;
 import java.util.*;

@@ -126,14 +127,23 @@
 
         try {
             String option = " -Dsun.rmi.activation.snapshotInterval=" +
                 SNAPSHOT_INTERVAL;
 
+            for (int i = 0; i < 20; i++) {
             RMID.removeLog();
             rmid = RMID.createRMID();
             rmid.addOptions(new String[] {option, "-Djava.compiler="});
+                try {
             rmid.start();
+                    break;
+                } catch (BindException ex) {
+                    System.err.format("%ncatch BindException(%s), "
+                            + "continue to launch rmid again...%n%n", ex.getMessage());
+                    continue;
+                }
+            }
 
             /* Cause activation groups to have a security policy that will
              * allow security managers to be downloaded and installed
              */
             Properties p = new Properties();
< prev index next >