use of com.lmax.disruptor.dsl.stubs.EventHandlerStub in project disruptor by LMAX-Exchange.
the class DisruptorTest method shouldWaitUntilAllFirstEventProcessorsProcessEventBeforeMakingItAvailableToDependentEventProcessors.
@Test
public void shouldWaitUntilAllFirstEventProcessorsProcessEventBeforeMakingItAvailableToDependentEventProcessors() throws Exception {
DelayedEventHandler eventHandler1 = createDelayedEventHandler();
CountDownLatch countDownLatch = new CountDownLatch(2);
EventHandler<TestEvent> eventHandler2 = new EventHandlerStub<TestEvent>(countDownLatch);
disruptor.handleEventsWith(eventHandler1).then(eventHandler2);
ensureTwoEventsProcessedAccordingToDependencies(countDownLatch, eventHandler1);
}
use of com.lmax.disruptor.dsl.stubs.EventHandlerStub in project disruptor by LMAX-Exchange.
the class DisruptorTest method shouldSupportCustomProcessorsAsDependencies.
@Test
public void shouldSupportCustomProcessorsAsDependencies() throws Exception {
RingBuffer<TestEvent> ringBuffer = disruptor.getRingBuffer();
final DelayedEventHandler delayedEventHandler = createDelayedEventHandler();
CountDownLatch countDownLatch = new CountDownLatch(2);
EventHandler<TestEvent> handlerWithBarrier = new EventHandlerStub<TestEvent>(countDownLatch);
final BatchEventProcessor<TestEvent> processor = new BatchEventProcessor<TestEvent>(ringBuffer, ringBuffer.newBarrier(), delayedEventHandler);
disruptor.handleEventsWith(processor).then(handlerWithBarrier);
ensureTwoEventsProcessedAccordingToDependencies(countDownLatch, delayedEventHandler);
}
use of com.lmax.disruptor.dsl.stubs.EventHandlerStub in project disruptor by LMAX-Exchange.
the class DisruptorTest method shouldAllowEventHandlerWithSuperType.
@Test
public void shouldAllowEventHandlerWithSuperType() throws Exception {
final CountDownLatch latch = new CountDownLatch(2);
final EventHandler<Object> objectHandler = new EventHandlerStub<Object>(latch);
disruptor.handleEventsWith(objectHandler);
ensureTwoEventsProcessedAccordingToDependencies(latch);
}
use of com.lmax.disruptor.dsl.stubs.EventHandlerStub in project disruptor by LMAX-Exchange.
the class DisruptorTest method shouldMakeEntriesAvailableToFirstHandlersImmediately.
@Test
public void shouldMakeEntriesAvailableToFirstHandlersImmediately() throws Exception {
CountDownLatch countDownLatch = new CountDownLatch(2);
EventHandler<TestEvent> eventHandler = new EventHandlerStub<TestEvent>(countDownLatch);
disruptor.handleEventsWith(createDelayedEventHandler(), eventHandler);
ensureTwoEventsProcessedAccordingToDependencies(countDownLatch);
}
use of com.lmax.disruptor.dsl.stubs.EventHandlerStub in project disruptor by LMAX-Exchange.
the class DisruptorTest method shouldAllowChainingEventHandlersWithSuperType.
@Test
public void shouldAllowChainingEventHandlersWithSuperType() throws Exception {
final CountDownLatch latch = new CountDownLatch(2);
final DelayedEventHandler delayedEventHandler = createDelayedEventHandler();
final EventHandler<Object> objectHandler = new EventHandlerStub<Object>(latch);
disruptor.handleEventsWith(delayedEventHandler).then(objectHandler);
ensureTwoEventsProcessedAccordingToDependencies(latch, delayedEventHandler);
}
Aggregations