# HG changeset patch # User rriggs # Date 1498843705 14400 # Node ID 83b617bc344af4476758192305e6cfc35490904d # Parent 4e40b6e090647d92d3c6896b5027f4504ce8ce28 8183019: Diagnostics for onExitTest Reviewed-by: clanger diff -r 4e40b6e09064 -r 83b617bc344a jdk/test/java/lang/ProcessHandle/OnExitTest.java --- a/jdk/test/java/lang/ProcessHandle/OnExitTest.java Thu Jun 29 18:42:01 2017 -0700 +++ b/jdk/test/java/lang/ProcessHandle/OnExitTest.java Fri Jun 30 13:28:25 2017 -0400 @@ -42,14 +42,7 @@ * @test * @key intermittent * @library /test/lib - * @modules java.base/jdk.internal.misc - * jdk.management * @build jdk.test.lib.Utils - * jdk.test.lib.Asserts - * jdk.test.lib.JDKToolFinder - * jdk.test.lib.JDKToolLauncher - * jdk.test.lib.Platform - * jdk.test.lib.process.* * @run testng OnExitTest * @summary Functions of Process.onExit and ProcessHandle.onExit * @author Roger Riggs @@ -251,10 +244,30 @@ } Assert.assertNull(line, "waitpid didn't wait"); + A.toHandle().onExit().thenAccept(p -> { + System.out.printf(" A.toHandle().onExit().A info: %s, now: %s%n", + p.info(), Instant.now()); + }); + + A.onExit().thenAccept(p -> { + System.out.printf(" A.onExit().A info: %s, now: %s%n", + p.info(), Instant.now()); + }); + + ProcessHandle.Info A_info = A.info(); + A.sendAction("exit", 0L); // Look for B to report that A has exited do { + Instant start = Instant.now(); + while (blines.isEmpty() && A.isAlive()) { + A_info = A.info(); // Spin + } + Instant end = Instant.now(); + System.out.printf(" a.isAlive: %s, a.info: %s, @%s%n", A.isAlive(), A.info(), + Duration.between(start, end)); + split = getSplitLine(blines); } while (!"waitpid".equals(split[1]));