Describe the feature
Currently emit method looks like
@Override
public final <T> void emit(T argument, Handler<T> task) {
if (executor().inThread()) {
ContextInternal prev = beginDispatch();
try {
task.handle(argument);
} catch (Throwable t) {
reportException(t);
} finally {
endDispatch(prev);
}
} else {
executor().execute(() -> emit(argument, task));
}
}
while dispatch is
default <E> void dispatch(E event, Handler<E> handler) {
ContextInternal prev = beginDispatch();
try {
handler.handle(event);
} catch (Throwable t) {
reportException(t);
} finally {
endDispatch(prev);
}
}
so it is effective duplicate logic of dispatch in the "if (executor().inThread())" branch.
Contribution
here is PR #6085
Describe the feature
Currently emit method looks like
while dispatch is
so it is effective duplicate logic of dispatch in the "if (executor().inThread())" branch.
Contribution
here is PR #6085