当前位置:网站首页>Disruptor本地线程队列_使用transProcessor处理器和WorkPool两种方式进行消费对比---线程间通信工作笔记005
Disruptor本地线程队列_使用transProcessor处理器和WorkPool两种方式进行消费对比---线程间通信工作笔记005
2022-06-26 19:49:00 【脑瓜凉】

然后我们再来看,这里的
EventProcessor消息处理器,和
WorkerPool消息处理器

可以看到我们说这个EventProdessor可以看作是生产者,用来生产数据的
WorkProcessor是消费者对吧,而一个WorkerPool可以说是一个线程池,而一个个的
WorkProcessor就是消费用的线程.可以看到多个WorkProcessor同时消费的时候,可以保证,
同一个sequence不被多个WorkProcessor消费

可以看到上面这个Trade就是交易的意思,我们现在用Disruptor来处理交易数据
可以看到有id 订单编号,有name,有price价格对吧还有个AtomicInteger这个 count先不用管
这个Trade就相当于我们之前说的Event,就是代表数据对吧.

数据Trade肯定需要有个Factory,来生产trade数据,这里我们直接在main中生产trade
首先buffer_size是环形缓冲区大小
边栏推荐
- Xlua get button registration click event of ugui
- The two files are merged into a third file.
- Résumé des points de connaissance
- SSO微服务工程中用户行为日志的记录
- 品达通用权限系统(Day 3~Day 4)
- 【推荐收藏】这8个常用缺失值填充技巧一定要掌握
- Is it safe to open an account for CICC Wealth Online?
- 数据库SQL语句撰写
- Minimum spanning tree, shortest path, topology sorting, critical path
- Wechat applet uniapp left slide delete with Delete Icon
猜你喜欢

Refresh the strong pointer assignment problem in the HP-UX system of Sanguan

数据库SQL语句撰写

Unity——Mathf. Similarities and differences between atan and atan2

Uni app uses canvas to draw QR code

50 lines of code to crawl TOP500 books and import TXT documents

Three basic backup methods of mongodb

Guomingyu: Apple's AR / MR head mounted display is the most complicated product in its history and will be released in January 2023

Good thing recommendation: mobile terminal development security tool

一些基本错误

Tiktok practice ~ sharing module ~ generate short video QR code
随机推荐
微服务架构
Bonne Recommandation: développer des outils de sécurité pour les terminaux mobiles
Installation and use of filebeat
网上办理中金财富开户安全吗?
好物推薦:移動端開發安全工具
IK分词器
自己创建一个时间拦截器
知識點總結
抖音实战~搜索页面~扫描二维码
限流设计及实现
Minimum spanning tree, shortest path, topology sorting, critical path
Arduino uno + DS1302 uses 31 byte static RAM to store data and print through serial port
uni-app使用canvas绘制二维码
To: Apple CEO Cook: great ideas come from constantly rejecting the status quo
Development principle analysis and source code of dapp-lp single and dual currency liquidity pledge mining system
读书笔记:《过程咨询 III》
Unity - URP get camera stack
西瓜书重温(七): 贝叶斯分类器(手推+代码demo)
Redis single sign on system + voting system
Web resource preloading - production environment practice