/** * Construct a {@link EventProcessor} that will automatically track the progress by updating its sequence when * the {@link com.lmax.disruptor.EventHandler#onEvent(Object, long, boolean)} method returns. * * @param ringBuffer to which events are published. * @param sequenceBarrier on which it is waiting. * @param eventHandler is the delegate to which events are dispatched. * @param turn is the value of, sequence % groupCount this batch processor process events. Turn must be * less than groupCount * @param groupCount total number of concurrent batch processors for the event type * @param batchSize size limit of total content size to batch. This is a loose limit */ public ConcurrentContentReadTaskBatchProcessor(final RingBuffer<DeliveryEventData> ringBuffer, final SequenceBarrier sequenceBarrier, final ContentCacheCreator eventHandler, long turn, int groupCount, int batchSize) { if (turn >= groupCount) { throw new IllegalArgumentException("Turn should be less than groupCount"); } this.ringBuffer = ringBuffer; this.sequenceBarrier = sequenceBarrier; this.eventHandler = eventHandler; this.turn = turn; this.groupCount = groupCount; this.batchSize = batchSize; exceptionHandler = new DeliveryExceptionHandler(); running = new AtomicBoolean(false); if (eventHandler instanceof SequenceReportingEventHandler) { ((SequenceReportingEventHandler<?>) eventHandler).setSequenceCallback(sequence); } }