com.lmax.disruptor
Interface BatchHandler<T extends AbstractEntry>

Type Parameters:
T - AbstractEntry implementation storing the data for sharing during exchange or parallel coordination of an event.
All Known Subinterfaces:
SequenceTrackingHandler<T>

public interface BatchHandler<T extends AbstractEntry>

Callback interface to be implemented for processing AbstractEntrys as they become available in the RingBuffer

See Also:
if you want to handle exceptions propigated out of the handler.

Method Summary
 void onAvailable(T entry)
          Called when a publisher has committed an AbstractEntry to the RingBuffer
 void onEndOfBatch()
          Called after each batch of items has been have been processed before the next waitFor call on a ConsumerBarrier.
 

Method Detail

onAvailable

void onAvailable(T entry)
                 throws java.lang.Exception
Called when a publisher has committed an AbstractEntry to the RingBuffer

Parameters:
entry - committed to the RingBuffer
Throws:
java.lang.Exception - if the BatchHandler would like the exception handled further up the chain.

onEndOfBatch

void onEndOfBatch()
                  throws java.lang.Exception
Called after each batch of items has been have been processed before the next waitFor call on a ConsumerBarrier.

This can be taken as a hint to do flush type operations before waiting once again on the ConsumerBarrier. The user should not expect any pattern or frequency to the batch size.

Throws:
java.lang.Exception - if the BatchHandler would like the exception handled further up the chain.


Copyright © 2011 LMAX Ltd. All Rights Reserved.