ExecutorService threadPool = Executors.newFixedThreadPool(1);
CompletionService<Object> completeService = new ExecutorCompletionService<Object>(
threadPool);
for (final HttpContentRetriever retriver : httpContentRetrievers) {
completeService.submit(new Runnable() {
@Override
public void run() {
try {
performParseAndAggregate(retriver.getInputStream(),
filePath, startDate, endDate, parserTyper,
pivotCallback);
} catch (Exception e) {
e.printStackTrace();
}
}
}, null);
}
for (int i = 0; i < httpContentRetrievers.length; i++) {
try {
completeService.take();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
threadPool.shutdown();
Iterator<Map<String, Object>> iter = pivotCallback.createView()
.listAll();