Fix EventProducer kill and TestRecursive JEP-349-branch
authormgronlun
Sun, 13 Oct 2019 12:36:51 +0200
branchJEP-349-branch
changeset 58577 7e0f81f63890
parent 58576 96c769cba8a3
child 58578 7b89c53db169
Fix EventProducer kill and TestRecursive
test/jdk/jdk/jfr/api/consumer/recordingstream/EventProducer.java
test/jdk/jdk/jfr/api/consumer/recordingstream/TestRecursive.java
--- a/test/jdk/jdk/jfr/api/consumer/recordingstream/EventProducer.java	Sat Oct 12 16:12:51 2019 +0200
+++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/EventProducer.java	Sun Oct 13 12:36:51 2019 +0200
@@ -25,10 +25,10 @@
         synchronized (lock) {
             this.killed = true;
             lock.notifyAll();
-            try {
-                join();
-            } catch (InterruptedException e) {
-            }
-        }
+        }
+        try {
+            join();
+        } catch (InterruptedException e) {
+        }
     }
 }
\ No newline at end of file
--- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestRecursive.java	Sat Oct 12 16:12:51 2019 +0200
+++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestRecursive.java	Sun Oct 13 12:36:51 2019 +0200
@@ -123,22 +123,19 @@
     private static void testSync() throws Exception {
         try (Recording r = new Recording()) {
             r.start();
-            AtomicBoolean first = new AtomicBoolean();
             EventProducer p = new EventProducer();
             try (RecordingStream rs = new RecordingStream()) {
                 Recorded e1 = new Recorded();
                 e1.commit();
                 rs.onEvent(e -> {
-                    if (first.get()) {
-                        System.out.println("Emitting NotRecorded event");
-                        NotRecorded event = new NotRecorded();
-                        event.commit();
-                        System.out.println("Stopping event provoker");
-                        p.kill();
-                        System.out.println("Closing recording stream");
-                        rs.close();
-                        return;
-                    }
+                    System.out.println("Emitting NotRecorded event");
+                    NotRecorded event = new NotRecorded();
+                    event.commit();
+                    System.out.println("Stopping event provoker");
+                    p.kill();
+                    System.out.println("Closing recording stream");
+                    rs.close();
+                    return;
                 });
                 p.start();
                 rs.start();