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 Sequence
s. 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!