Disruptor: Gating Sequence

戏子无情 提交于 2019-12-22 18:34:29

问题


I am studying Disruptor in Java. I do not understand what's meaning of gating sequence. I know it core part is ring buffer and every buffer is associated with a sequence number.


回答1:


The purpose of gating sequences is to gate publishers to prevent the RingBuffer from wrapping.




回答2:


Actually the core part of LMAX's implementation is the Sequencer and its Sequences. And so the ringBuffer implement those. The gatingSequences that you are referring to act as a cursor to each Sequencer that is "Subscribed" to the targeted ringBuffer (or other Sequencer). So that's how a Sequencer can have multiple cursors for its connected Sequencers (and let them touch the next sequence by just calling tryNext() ).

Cheers!



来源:https://stackoverflow.com/questions/13722809/disruptor-gating-sequence

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