使用并行流处理大量带有大量数据的文件,并将它们写入特定格式。以下是代码:
public static void main(String[] args) throws Exception {
mergeController.compactFiles();
mergeController.writeMergedFlag();
}
private void compactFiles() {
Set<String> events = this.listSubDirectoryNames(inputDir);
events.parallelStream().forEach(event -> writeEvent(event, eventSchemaMap.get(event), this.configuration));
}
这些方法并不返回任何东西,它们只是在写入文件。我发现writeMergedFlag()
通常在运行过程中1.5小时后被调用。
这里有什么问题吗?是堆空间问题还是其他问题?我以前没有遇到过这种问题。
writeMergedFlag()
)要等到1.5小时后才会执行。由于您期望它等待,并且它确实在等待,因此不清楚您认为问题是什么。 - Andreas