现在我们来看看Main.java的第三步:disruptor.start(),点开start方法看看
public RingBuffer<T> start()
{
final Sequence[] gatingSequences = consumerRepository.getLastSequenceInChain(true);
ringBuffer.addGatingSequences(gatingSequences);
checkOnlyStartedOnce();
for (final ConsumerInfo consumerInfo : consumerRepository)
{
consumerInfo.start(executor);
}
return ringBuffer;
}
这里有我们上一张进行操作的gatingSequences字段,看看是如何获取的,点开getLastSequenceInChain方法看看
public Sequence[] getLastSequenceInChain(boolean includeStopped)
{
//1.
List<Sequence> lastSequence = new ArrayList<Sequence>();
//2.
for (ConsumerInfo consumerInfo :