disruptor 核心概念

我是研究僧i 提交于 2019-12-03 00:39:22

Ring Buffer:  The Ring Buffer is often considered the main aspect of the Disruptor, however from 3.0 onwards the Ring Buffer is only responsible for the storing and updating of the data (Events) that move through the Disruptor.  And for some advanced use cases can be completely replaced by the user.


Sequence:  The Disruptor uses Sequences as a means to identify where a particular component is up to.  Each consumer (EventProcessor) maintains a Sequence as does the Disruptor itself.  The majority of the concurrent code relies on the the movement of these Sequence values, hence the Sequence supports many of the current features of an AtomicLong.  In fact the only real difference between the 2 is that the Sequence contains additional functionality to prevent false sharing between Sequences and other values.

Sequencer:  The Sequencer is the real core of the Disruptor.  The 2 implementations (single producer, multi producer) of this interface implement all of the concurrent algorithms use for fast, correct passing of data between producers and consumers.

Sequence Barrier:  The Sequence Barrier is produced by the Sequencer and contains references to the main published Sequence from the Sequencer and the Sequences of any dependent consumer.  It contains the logic to determine if there are any events available for the consumer to process.

Wait Strategy:  ss  More details are available in the section about being optionally lock-free.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!