Skip to content

Commit

Permalink
Parallel processing of files
Browse files Browse the repository at this point in the history
  • Loading branch information
mkarg committed May 23, 2024
1 parent b253d99 commit 56fa4cd
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

import java.io.File;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.util.Collections;
Expand Down Expand Up @@ -635,8 +636,16 @@ private void processCommentStyle(String commentStyle, List<File> filesToTreat) t
FileHeaderTransformer transformer = getTransformer(transformers, commentStyle);
FileHeaderProcessor processor = getFileHeaderProcessor(license, transformer);

for (File file : filesToTreat) {
processFile(processor, file);
try {
filesToTreat.parallelStream().forEach(file -> {
try {
processFile(processor, file);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
});
} catch (UncheckedIOException e) {
throw e.getCause();
}
filesToTreat.clear();
}
Expand Down

0 comments on commit 56fa4cd

Please sign in to comment.