1
現在我正在使用disruptor,我得到了consumer-productor.It的一個簡單示例運行完美,但我不知道緩衝區大小的含義,我應該設置它的大小?如何設置disruptor的ClaimStrategy緩衝區大小
private static final int BUFFER_SIZE = 4;
private final RingBuffer<StockEvent> ringBuffer =
new RingBuffer<StockEvent>(StockEvent.EVENT_FACTORY,
new MultiThreadedLowContentionClaimStrategy(BUFFER_SIZE),
new YieldingWaitStrategy());
private final SequenceBarrier sequenceBarrier = ringBuffer.newBarrier();
BUFFER_SIZE是什麼意思?
好吧,我知道BUFFER_SIZE,它是ringbuffer array.try的大小,認爲它是一個隊列,BUFFER_SIZE是隊列的長度。 – guolei
實際上不能說這是隊列長度,因爲它的行爲不同。恕我直言,你可以說它是一個運行時緩衝區容量。 –