diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestProcess.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestProcess.java index dbbdbe9c67db2..e396fc3825831 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/TestProcess.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestProcess.java @@ -68,6 +68,9 @@ public TestProcess(String name, boolean createCore) throws IOException { }; ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(args); process = ProcessTools.startProcess(name, pb); + + // give the process a chance to awake (and to be seen from other threads) + takeLongNap(); } public static void main(String... args) throws Exception { @@ -99,6 +102,14 @@ public Path getRepository() throws Exception { return StreamingUtils.getJfrRepository(process); } + private static void takeLongNap() { + try { + Thread.sleep(1000); + } catch (InterruptedException ie) { + // ignore + } + } + private static void takeNap() { try { Thread.sleep(10);