use of com.lmax.disruptor.RingBuffer in project disruptor by LMAX-Exchange.
the class DisruptorTest method should.
@Test
public void should() throws Exception {
RingBuffer<TestEvent> rb = disruptor.getRingBuffer();
BatchEventProcessor<TestEvent> b1 = new BatchEventProcessor<TestEvent>(rb, rb.newBarrier(), new SleepingEventHandler());
EventProcessorFactory<TestEvent> b2 = new EventProcessorFactory<TestEvent>() {
@Override
public EventProcessor createEventProcessor(RingBuffer<TestEvent> ringBuffer, Sequence[] barrierSequences) {
return new BatchEventProcessor<TestEvent>(ringBuffer, ringBuffer.newBarrier(barrierSequences), new SleepingEventHandler());
}
};
disruptor.handleEventsWith(b1).then(b2);
disruptor.start();
}
Aggregations