How to create (Async)EventBus with ImmediateDispatcher?

Viewed 597

I'm trying to create an AsyncEventBus, with a ThreadPoolExecutor. I noticed that AsyncEventBus is hardcoded to always use a LegacyAsyncDispatcher. The javadoc of Dispatcher.legacyAsync() states:

For async dispatch, an immediate dispatcher should generally be preferable.

But I can't find any way of actually creating an AsyncEventBus with Dispatcher.immediate(). And then EventBus is hardcoded to use Dispatcher.perThreadDispatchQueue().

How does one create an ImmediateDispatcher and wire it into an EventBus?

1 Answers
Related