in impl/src/main/java/org/apache/rocketmq/remoting/impl/netty/NettyRemotingAbstract.java [294:328]
private void executeAsyncHandler(final ResponseFuture responseFuture) {
boolean runInThisThread = false;
ExecutorService executor = asyncHandlerExecutor;
if (executor != null) {
try {
executor.submit(new Runnable() {
@Override
public void run() {
try {
responseFuture.executeAsyncHandler();
} catch (Throwable e) {
LOG.warn("Execute async handler in specific executor exception, ", e);
} finally {
responseFuture.release();
}
}
});
} catch (Throwable e) {
runInThisThread = true;
LOG.warn("Execute async handler in executor exception, maybe the executor is busy now", e);
}
} else {
runInThisThread = true;
}
if (runInThisThread) {
try {
responseFuture.executeAsyncHandler();
} catch (Throwable e) {
LOG.warn("Execute async handler in current thread exception", e);
} finally {
responseFuture.release();
}
}
}