src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/Dispatcher.java
branchJEP-349-branch
changeset 58153 0f7562601338
parent 58146 9f3aadcaa430
child 58197 0ef79bd7fb5c
--- a/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/Dispatcher.java	Mon Sep 16 15:12:10 2019 +0200
+++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/Dispatcher.java	Mon Sep 16 15:16:59 2019 +0200
@@ -94,6 +94,24 @@
             }
             cacheDispatchers = dispatchers;
         }
+        // Expected behavior if exception occurs in onEvent:
+        //
+        // Synchronous:
+        //  - User has added onError action:
+        //     Catch exception, call onError and continue with next event
+        //     Let Errors propagate to caller of EventStream::start
+        //  - Default action
+        //     Catch exception, e.printStackTrace() and continue with next event
+        //     Let Errors propagate to caller of EventStream::start
+        //
+        // Asynchronous
+        //  - User has added onError action
+        //     Catch exception, call onError and continue with next event
+        //     Let Errors propagate, shutdown thread and stream
+        //  - Default action
+        //    Catch exception, e.printStackTrace() and continue with next event
+        //    Let Errors propagate and shutdown thread and stream
+        //
         for (int i = 0; i < dispatchers.length; i++) {
             try {
                 dispatchers[i].offer(event);