LMAX-Exchange/disruptor — pull request #100 by duarten (2014-11-03 15:41:31+00:00)
Title: SequenceBarrier: allow non-default WaitStrategy

This patch adds an overload of Sequencer::newBarrier that allows creating a SequenceBarrier with a particular WaitStrategy.

Rationale: In my project, I need to give particular EventProcessors a backchannel through which other threads can feed it work (e.g., because some data is confined to those EventProcessors or to guarantee ordering with events processed from the RingBuffer). I'm creating a new type of EventProcessor, identical to the BatchEventProcessor except that it checks for less-than-sequence return from the SequenceBarrier and calls a callback. That value is returned from WaitStrategies that are aware of the backchannel. Since these backchannels are per EventProcessor, I also need a WaitStrategy per EventProcessor. Right now I have a custom SequenceBarrier as well to tie the WaitStrategy with the EventProcessor, but with this patch I would no longer need to.