AsyncRunnerEventThread provides an event thread where each "event" (or task) is executed on a single thread. It's vital that the single event thread is not blocked and we should limit what runs on it to just the actual events.
Currently though, when an event returns a value, it's done via a SafeFuture which is completed on the event thread. This means that any chained handlers (e.g via .thenApply) are also executed on the event thread even though they won't be designed to avoid blocking.
We should modify AsyncRunnerEventThread to ensure that any returned futures trigger handlers in a separate thread pool. This would likely be something similar to how AsyncEventDeliverer ensures EventChannel responses are delivered in a specific thread pool (via the AsyncRunner responseRunner it's passed).
Description
AsyncRunnerEventThread
provides an event thread where each "event" (or task) is executed on a single thread. It's vital that the single event thread is not blocked and we should limit what runs on it to just the actual events.Currently though, when an event returns a value, it's done via a SafeFuture which is completed on the event thread. This means that any chained handlers (e.g via
.thenApply
) are also executed on the event thread even though they won't be designed to avoid blocking.We should modify
AsyncRunnerEventThread
to ensure that any returned futures trigger handlers in a separate thread pool. This would likely be something similar to howAsyncEventDeliverer
ensuresEventChannel
responses are delivered in a specific thread pool (via theAsyncRunner responseRunner
it's passed).