Description
Hi,
First of all thanks for this great project.
I'd like to configure MBassador such that the messages are being dispatched by the thread that publishes them, but processed by background threads supplied by AsynchronousHandlerInvocation
.
I thought that this could work:
private final MBassador<BaseEvent> mEventBus = new MBassador<>();
public void publishEvent(BaseEvent event) {
mEventBus.publish(event);
}
But then javadoc of publish(Object)
states:
Synchronously publish a message to all registered listeners (this includes listeners defined for super types) The call blocks until every messageHandler has processed the message.
The part about "blocks until every messageHandler has processed the message" is unacceptable for me, so I thought that this is not the right solution.
However, having spent some time in the source code, it looks like the call to publish(Object)
will block only until the processing have been delegated to messageHandlers, not until processing is actually done.
This looks like an incorrectly (or ambiguously) documented feature, but, before I build my system around it, I'd like to make sure that I got it right and the above code will indeed perform dispatching on the calling thread, and the calling thread will not wait for all processing to complete.