Package com.lmax.disruptor
Class BatchEventProcessorBuilder
java.lang.Object
com.lmax.disruptor.BatchEventProcessorBuilder
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> BatchEventProcessor<T> build(DataProvider<T> dataProvider, SequenceBarrier sequenceBarrier, EventHandler<? super T> eventHandler) Construct aEventProcessorthat will automatically track the progress by updating its sequence when theEventHandler.onEvent(Object, long, boolean)method returns.<T> BatchEventProcessor<T> build(DataProvider<T> dataProvider, SequenceBarrier sequenceBarrier, RewindableEventHandler<? super T> rewindableEventHandler, BatchRewindStrategy batchRewindStrategy) Construct aEventProcessorthat will automatically track the progress by updating its sequence when theEventHandler.onEvent(Object, long, boolean)method returns.setMaxBatchSize(int maxBatchSize) Set the maximum number of events that will be processed in a batch before updating the sequence.
-
Field Details
-
maxBatchSize
private int maxBatchSize
-
-
Constructor Details
-
BatchEventProcessorBuilder
public BatchEventProcessorBuilder()
-
-
Method Details
-
setMaxBatchSize
Set the maximum number of events that will be processed in a batch before updating the sequence.- Parameters:
maxBatchSize- max number of events to process in one batch.- Returns:
- The builder
-
build
public <T> BatchEventProcessor<T> build(DataProvider<T> dataProvider, SequenceBarrier sequenceBarrier, EventHandler<? super T> eventHandler) Construct aEventProcessorthat will automatically track the progress by updating its sequence when theEventHandler.onEvent(Object, long, boolean)method returns.The created
BatchEventProcessorwill not support batch rewind, butEventHandler.setSequenceCallback(Sequence)will be supported.- Type Parameters:
T- event implementation storing the data for sharing during exchange or parallel coordination of an event.- Parameters:
dataProvider- to which events are published.sequenceBarrier- on which it is waiting.eventHandler- is the delegate to which events are dispatched.- Returns:
- the BatchEventProcessor
-
build
public <T> BatchEventProcessor<T> build(DataProvider<T> dataProvider, SequenceBarrier sequenceBarrier, RewindableEventHandler<? super T> rewindableEventHandler, BatchRewindStrategy batchRewindStrategy) Construct aEventProcessorthat will automatically track the progress by updating its sequence when theEventHandler.onEvent(Object, long, boolean)method returns.- Type Parameters:
T- event implementation storing the data for sharing during exchange or parallel coordination of an event.- Parameters:
dataProvider- to which events are published.sequenceBarrier- on which it is waiting.rewindableEventHandler- is the delegate to which events are dispatched.batchRewindStrategy- aBatchRewindStrategyfor customizing how to handle aRewindableException.- Returns:
- the BatchEventProcessor
-