diff -r 74a38c0b5054 -r aa7b1ea52413 src/jdk.jfr/share/classes/jdk/jfr/consumer/EventStream.java --- a/src/jdk.jfr/share/classes/jdk/jfr/consumer/EventStream.java Thu Aug 29 19:40:37 2019 +0200 +++ b/src/jdk.jfr/share/classes/jdk/jfr/consumer/EventStream.java Fri Aug 30 20:39:38 2019 +0200 @@ -133,6 +133,21 @@ void onFlush(Runnable action); /** + * Performs an action if an exception occurs when processing the stream. + *

+ * if an error handler has not been added to the stream, an exception stack + * trace is printed to standard error. + *

+ * Adding an error handler overrides the default behavior. If multiple error + * handlers have been added, they will be executed in the order they were + * added. + * + * @param action an action to be performed if an exception occurs, not + * {@code null} + */ + void onError(Consumer action); + + /** * Performs an action when the event stream is closed. *

* If the stream is already closed, the action will be executed immediately