--- a/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/AbstractEventStream.java Mon Sep 16 15:12:10 2019 +0200
+++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/AbstractEventStream.java Mon Sep 16 15:16:59 2019 +0200
@@ -205,7 +205,7 @@
}
}
- protected abstract void process() throws Exception;
+ protected abstract void process() throws IOException;
protected final void setClosed(boolean closed) {
this.closed = closed;
@@ -252,10 +252,7 @@
// This can happen if a chunk file is removed, or
// a file is access that has been closed
// This is "normal" behavior for streaming and the
- // stream will be closed when this happens
- } catch (Exception e) {
- // TODO: Remove before integrating
- e.printStackTrace();
+ // stream will be closed when this happens.
} finally {
Logger.log(LogTag.JFR_SYSTEM_STREAMING, LogLevel.DEBUG, "Execution of stream ended.");
try {
--- 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);
--- a/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/EventDirectoryStream.java Mon Sep 16 15:12:10 2019 +0200
+++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/EventDirectoryStream.java Mon Sep 16 15:16:59 2019 +0200
@@ -79,7 +79,7 @@
}
@Override
- protected void process() throws Exception {
+ protected void process() throws IOException {
Dispatcher disp = dispatcher();
Path path;