use of com.lmax.disruptor.dsl.stubs.StubPublisher in project disruptor by LMAX-Exchange.
the class DisruptorTest method shouldBlockProducerUntilAllEventProcessorsHaveAdvanced.
@Test
public void shouldBlockProducerUntilAllEventProcessorsHaveAdvanced() throws Exception {
final DelayedEventHandler delayedEventHandler = createDelayedEventHandler();
disruptor.handleEventsWith(delayedEventHandler);
final RingBuffer<TestEvent> ringBuffer = disruptor.start();
delayedEventHandler.awaitStart();
final StubPublisher stubPublisher = new StubPublisher(ringBuffer);
try {
executor.newThread(stubPublisher).start();
assertProducerReaches(stubPublisher, 4, true);
delayedEventHandler.processEvent();
delayedEventHandler.processEvent();
delayedEventHandler.processEvent();
delayedEventHandler.processEvent();
delayedEventHandler.processEvent();
assertProducerReaches(stubPublisher, 5, false);
} finally {
stubPublisher.halt();
}
}
Aggregations