Synchronize iteration of synchronized list
@@ -246,10 +246,12 @@ public void writeTo(final ZipArchiveOutputStream targetStream)
// It is important that all threads terminate before we go on, ensure happens-before relationship
compressionDoneAt = System.currentTimeMillis();
+ synchronized (streams) {
for (final ScatterZipOutputStream scatterStream : streams) {
scatterStream.writeTo(targetStream);
scatterStream.close();
}
+ }
scatterDoneAt = System.currentTimeMillis();
}
