WorkMgr: parallel copy files during fork
@@ -1518,14 +1518,17 @@ public class WorkMgr extends AbstractCoordinator {
try (Stream<String> baseInputObjectKeys =
_storage.listSnapshotInputObjectKeys(new NetworkSnapshot(networkId, baseSnapshotId))) {
- baseInputObjectKeys.forEach(
+ List<String> allKeys = baseInputObjectKeys.collect(Collectors.toList());
+ allKeys.parallelStream()
+ .forEach(
key -> {
try (InputStream baseObjectStream =
_storage.loadSnapshotInputObject(networkId, baseSnapshotId, key)) {
writeStreamToFile(baseObjectStream, newSnapshotInputsDir.resolve(key));
} catch (IOException e) {
throw new UncheckedIOException(
- String.format("Unable to copy base snapshot input object with key: %s", key), e);
+ String.format("Unable to copy base snapshot input object with key: %s", key),
+ e);
}
});
}
