We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
com.alipay.sofa.rpc.event.EventBus#post
/** * 给事件总线中丢一个事件 * * @param event 事件 */ public static void post(final Event event) { if (!isEnable()) { return; } CopyOnWriteArraySet<Subscriber> subscribers = SUBSCRIBER_MAP.get(event.getClass()); if (CommonUtils.isNotEmpty(subscribers)) { for (final Subscriber subscriber : subscribers) { if (subscriber.isSync()) { handleEvent(subscriber, event); } else { // 异步 final RpcInternalContext context = RpcInternalContext.peekContext(); AsyncRuntime.getAsyncThreadPool().execute( new Runnable() { @Override public void run() { try { RpcInternalContext.setContext(context); handleEvent(subscriber, event); } catch (Exception e) { RpcInternalContext.removeContext(); } } }); } } } }
if AsyncRuntime.getAsyncThreadPool().execute throw an exception because of queue is full, the current thread will break
AsyncRuntime.getAsyncThreadPool().execute
maybe we need to catch this exception . subscriber which is async need to accept the lost of event.
describe the advice or solution you'd like
java -version
uname -a
The text was updated successfully, but these errors were encountered:
leizhiyuan
No branches or pull requests
Your question
com.alipay.sofa.rpc.event.EventBus#post
if
AsyncRuntime.getAsyncThreadPool().execute
throw an exception because of queue is full, the current thread will breakYour scenes
maybe we need to catch this exception . subscriber which is async need to accept the lost of event.
Your advice
describe the advice or solution you'd like
Environment
java -version
):uname -a
):The text was updated successfully, but these errors were encountered: