Repository: commons-compress Updated Branches: refs/heads/master 10ff1c341 -> 78cb9bf36
COMPRESS-430: Synchronize iteration of synchronized list Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/ff0e8420 Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/ff0e8420 Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/ff0e8420 Branch: refs/heads/master Commit: ff0e842058091b3310340f51a130a65a1cf6f725 Parents: 10ff1c3 Author: Bruno P. Kinoshita <[email protected]> Authored: Sat Nov 25 22:57:30 2017 +1300 Committer: Stefan Bodewig <[email protected]> Committed: Sat Nov 25 16:54:51 2017 +0100 ---------------------------------------------------------------------- .../compress/archivers/zip/ParallelScatterZipCreator.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ff0e8420/src/main/java/org/apache/commons/compress/archivers/zip/ParallelScatterZipCreator.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ParallelScatterZipCreator.java b/src/main/java/org/apache/commons/compress/archivers/zip/ParallelScatterZipCreator.java index dc14499..9513da2 100644 --- a/src/main/java/org/apache/commons/compress/archivers/zip/ParallelScatterZipCreator.java +++ b/src/main/java/org/apache/commons/compress/archivers/zip/ParallelScatterZipCreator.java @@ -246,9 +246,11 @@ public class ParallelScatterZipCreator { // It is important that all threads terminate before we go on, ensure happens-before relationship compressionDoneAt = System.currentTimeMillis(); - for (final ScatterZipOutputStream scatterStream : streams) { - scatterStream.writeTo(targetStream); - scatterStream.close(); + synchronized (streams) { + for (final ScatterZipOutputStream scatterStream : streams) { + scatterStream.writeTo(targetStream); + scatterStream.close(); + } } scatterDoneAt = System.currentTimeMillis();
