8077402: JMXStartStopTest fails intermittently on slow hosts
authorjbachorik
Mon, 27 Apr 2015 10:12:56 +0200
changeset 30359 b2b7b66cd9eb
parent 30358 15b7f8ff367c
child 30360 c34ae192d75f
8077402: JMXStartStopTest fails intermittently on slow hosts Reviewed-by: sla, dholmes
jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java
jdk/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java
jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java
--- a/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java	Tue Apr 21 10:24:20 2015 +0200
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java	Mon Apr 27 10:12:56 2015 +0200
@@ -227,7 +227,8 @@
      * <span>The default redirects of STDOUT and STDERR are started</span>
      * <p>
      * It is possible to wait for the process to get to a warmed-up state
-     * via {@linkplain Predicate} condition on the STDOUT
+     * via {@linkplain Predicate} condition on the STDOUT. The warm-up will
+     * wait indefinitely.
      * </p>
      * @param name The process name
      * @param processBuilder The process builder
--- a/jdk/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java	Tue Apr 21 10:24:20 2015 +0200
+++ b/jdk/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java	Mon Apr 27 10:12:56 2015 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -120,9 +120,7 @@
                         return true;
                     }
                     return false;
-                },
-                5,
-                TimeUnit.SECONDS
+                }
             );
 
             System.out.println("Attaching test manager:");
@@ -142,9 +140,7 @@
             clientPrc = ProcessTools.startProcess(
                 "TestManager",
                 client,
-                (String line) -> line.startsWith("Starting TestManager for PID"),
-                10,
-                TimeUnit.SECONDS
+                (String line) -> line.startsWith("Starting TestManager for PID")
             );
 
             int clientExitCode = clientPrc.waitFor();
--- a/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java	Tue Apr 21 10:24:20 2015 +0200
+++ b/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java	Mon Apr 27 10:12:56 2015 +0200
@@ -311,9 +311,7 @@
                                 error.set(line.contains("BindException"));
 
                                 return ok || error.get();
-                            },
-                            5,
-                            TimeUnit.SECONDS
+                            }
                     );
                     if (error.get()) {
                         throw new BindException("Starting process failed due to " +
@@ -321,8 +319,10 @@
                     }
                     pid = p.getPid();
                 } catch (TimeoutException e) {
-                    p.destroy();
-                    p.waitFor();
+                    if (p != null) {
+                        p.destroy();
+                        p.waitFor();
+                    }
                     throw e;
                 }
             }