use of com.lmax.disruptor.dsl.stubs.TestWorkHandler in project disruptor by LMAX-Exchange.
the class DisruptorTest method shouldProvideEventsMultipleWorkHandlers.
@Test
public void shouldProvideEventsMultipleWorkHandlers() throws Exception {
final TestWorkHandler workHandler1 = createTestWorkHandler();
final TestWorkHandler workHandler2 = createTestWorkHandler();
final TestWorkHandler workHandler3 = createTestWorkHandler();
final TestWorkHandler workHandler4 = createTestWorkHandler();
final TestWorkHandler workHandler5 = createTestWorkHandler();
final TestWorkHandler workHandler6 = createTestWorkHandler();
final TestWorkHandler workHandler7 = createTestWorkHandler();
final TestWorkHandler workHandler8 = createTestWorkHandler();
disruptor.handleEventsWithWorkerPool(workHandler1, workHandler2).thenHandleEventsWithWorkerPool(workHandler3, workHandler4);
disruptor.handleEventsWithWorkerPool(workHandler5, workHandler6).thenHandleEventsWithWorkerPool(workHandler7, workHandler8);
}
use of com.lmax.disruptor.dsl.stubs.TestWorkHandler in project disruptor by LMAX-Exchange.
the class DisruptorTest method shouldSupportUsingWorkerPoolWithADependency.
@Test
public void shouldSupportUsingWorkerPoolWithADependency() throws Exception {
final TestWorkHandler workHandler1 = createTestWorkHandler();
final TestWorkHandler workHandler2 = createTestWorkHandler();
final DelayedEventHandler delayedEventHandler = createDelayedEventHandler();
disruptor.handleEventsWith(delayedEventHandler).thenHandleEventsWithWorkerPool(workHandler1, workHandler2);
publishEvent();
publishEvent();
delayedEventHandler.processEvent();
delayedEventHandler.processEvent();
workHandler1.processEvent();
workHandler2.processEvent();
}
use of com.lmax.disruptor.dsl.stubs.TestWorkHandler in project disruptor by LMAX-Exchange.
the class DisruptorTest method shouldSetSequenceForWorkProcessorIfAddedAfterPublish.
@Test
public void shouldSetSequenceForWorkProcessorIfAddedAfterPublish() throws Exception {
RingBuffer<TestEvent> rb = disruptor.getRingBuffer();
TestWorkHandler wh1 = createTestWorkHandler();
TestWorkHandler wh2 = createTestWorkHandler();
TestWorkHandler wh3 = createTestWorkHandler();
rb.publish(rb.next());
rb.publish(rb.next());
rb.publish(rb.next());
rb.publish(rb.next());
rb.publish(rb.next());
rb.publish(rb.next());
disruptor.handleEventsWithWorkerPool(wh1, wh2, wh3);
assertThat(disruptor.getRingBuffer().getMinimumGatingSequence(), is(5L));
}
use of com.lmax.disruptor.dsl.stubs.TestWorkHandler in project disruptor by LMAX-Exchange.
the class DisruptorTest method shouldSupportUsingWorkerPoolAsDependencyAndProcessFirstEventAsSoonAsItIsAvailable.
@Test
public void shouldSupportUsingWorkerPoolAsDependencyAndProcessFirstEventAsSoonAsItIsAvailable() throws Exception {
final TestWorkHandler workHandler1 = createTestWorkHandler();
final TestWorkHandler workHandler2 = createTestWorkHandler();
final DelayedEventHandler delayedEventHandler = createDelayedEventHandler();
disruptor.handleEventsWithWorkerPool(workHandler1, workHandler2).then(delayedEventHandler);
publishEvent();
publishEvent();
workHandler1.processEvent();
delayedEventHandler.processEvent();
workHandler2.processEvent();
delayedEventHandler.processEvent();
}
Aggregations