org.rutil.util
Interface BatchProcessCallback<T>


public interface BatchProcessCallback<T>

A callback to be implemented by classes that process the request in smaller batches.

Author:
mohan
See Also:
BatchProcessor

Method Summary
 int getBatchSize()
           
 java.util.Collection<T> getItems()
          Collection of items to be processed in batches.
 int getSize(T item)
          This method will normally return 1 but T could be a List or another object that has more than one entries.
 void processBatch(java.util.List<T> items, int batchSize)
          A batch of items to process.
 

Method Detail

getBatchSize

int getBatchSize()
Returns:
size of each batch

getSize

int getSize(T item)
This method will normally return 1 but T could be a List or another object that has more than one entries.

Parameters:
item - an item from the Collection(See getItems())
Returns:
number of items contained in this item or 1 if this is the item to be processed.

getItems

java.util.Collection<T> getItems()
Collection of items to be processed in batches.

Returns:
items.

processBatch

void processBatch(java.util.List<T> items,
                  int batchSize)
A batch of items to process.

Parameters:
items - batched items.
batchSize - value equal to OR less than value returned by getBatchSize()