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();
多线程处理
最新推荐文章于 2025-09-13 12:59:37 发布
1070

被折叠的 条评论
为什么被折叠?



