首页 > 其他 > 详细

EventBus

时间:2019-10-12 09:30:30      阅读:65      评论:0      收藏:0      [点我收藏+]

EventBus:
0: Register one object as subscriber in registry
1: Search annotations on all subscriber‘s methods which has only one parameter as event type
2: Create the subscriber with object, executor and its method
3: Put the created subscriber to map with event type as key
4. Post event in multi-thread
5. Get all subscriber by event type
6. Dispatcher dispatch event to its every subscriber which has executor, listener and method
7. Dispatcher put event to queue for every post thread
8. Run handler of subscriber with event by invoking method of subscriber in executor

 

Refactor to reactor:

1. Introduce selector

2. Introduce Global bus system

3. Introduce queue for every event type, every event type can look as socket channel

EventBus

原文:https://www.cnblogs.com/iiiDragon/p/EventBus.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!