#1. When InsertEventHandler begin to consumer the data in ringbuffer, does it need to wait for the completion of the insertion of InsertEventHandler before moving to the next index in ringbuffer?
#2. Could 5 InsertEventHandler consumer 5 message in the ringbuffer simultaneously?
To add to Mike's code, if you have a dependency graphs like this:
disruptor.handleEventsWith(doInitialThings)
.then(insertIntoTableHandler).
.then(concludingThings)
and you want the "concludingThings" to operate as soon as the "flushBatch()" has executed you need this optimization:
1. add to your Handler the interface SequenceReportingEventHandler
2. add
public void setSequenceCallback(Sequence sequence) {
this.sequenceCallback = sequence;
}
3. change the end of batch processing:
Explanation:
Normally when the the class managing your EventHandler (BatchEventProcessor) detects a batch, it will call your onEvent successively and only mark all the events from the batch handled once the last onEvent has returned. Now suppose your Handler had been busy inserting a batch and a massive backlog of 1000 events had built up. Let's assume that you have set batchSize=100 then flushBatch() will execute 10 times and none of the 1000 events will be "released" do the following concludingThings handler. By adding the sequence.set(lastSequence), concludingThings gets access to the events when your inner batch has finished.
--
You received this message because you are subscribed to the Google Groups "Disruptor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lmax-disrupto...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
BTW, if batch is used, could multi-threading of batching increase the performance?
--
Can you please elaborate more on this logic?
if((sequence & mask)==ordinal)
Is it possible to add more than 2 handlers with the current logic that you have?
ParallelEventHandler handler1 = new ParallelEventHandler(1, 0);
ParallelEventHandler handler2 = new ParallelEventHandler(1, 1);
--