test/runtime/7158988/TestPostFieldModification.java

Print this page

        

@@ -19,10 +19,12 @@
  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
 
+import java.io.File;
+
 public class TestPostFieldModification {
 
   public String value;  // watch modification of value
 
   public static void main(String[] args){

@@ -34,10 +36,27 @@
       public void run() {
         test.value="test";
         for(int i = 0; i < 10; i++) {
           test.value += new String("_test");
         }
+
+        // JDK-8007710: if OK to exit
+        File file = new File(System.getProperty("user.dir"), FieldMonitor.MY_TMP_FILE_NAME);
+        System.out.println("---TestPostFieldModification-run waiting: "
+                    + file.getAbsolutePath());
+        
+        while (!file.exists()) {
+            try {
+                Thread.sleep(100);
+            } catch (Exception e) {
+                System.out.println("---TestPostFieldModification-run impossible? "+e);
+                e.printStackTrace();
+                break;
+            }
+        }
+         
+        System.out.println("---TestPostFieldModification-run bye!");
       }
     }.start();
 
     // this thread is used to trigger a gc
     Thread d = new Thread() {