final int NUM_SPLITS = 500;
final int SUM_OF_IDS = (NUM_SPLITS-1) * (NUM_SPLITS) / 2;
Set<InputSplit> splits = new HashSet<InputSplit>();
for (int i = 0; i < NUM_SPLITS; i++) {
splits.add(new GenericInputSplit(i, NUM_SPLITS));
}
final DefaultInputSplitAssigner ia = new DefaultInputSplitAssigner(splits);
final AtomicInteger splitsRetrieved = new AtomicInteger(0);
final AtomicInteger sumOfIds = new AtomicInteger(0);
Runnable retriever = new Runnable() {
@Override
public void run() {
String host = "";
GenericInputSplit split;
while ((split = (GenericInputSplit) ia.getNextInputSplit(host)) != null) {
splitsRetrieved.incrementAndGet();
sumOfIds.addAndGet(split.getSplitNumber());
}
}
};
// create the threads