|
@@ -23,9 +23,9 @@ import java.io.InputStream;
|
|
import java.io.OutputStream;
|
|
import java.io.OutputStream;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.Collection;
|
|
import java.util.Collection;
|
|
|
|
+import java.util.Collections;
|
|
import java.util.Iterator;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
-import java.util.concurrent.CopyOnWriteArrayList;
|
|
|
|
import java.util.concurrent.CountDownLatch;
|
|
import java.util.concurrent.CountDownLatch;
|
|
import java.util.concurrent.ExecutorService;
|
|
import java.util.concurrent.ExecutorService;
|
|
import java.util.concurrent.Executors;
|
|
import java.util.concurrent.Executors;
|
|
@@ -227,8 +227,7 @@ public final class FSImageFormatPBINode {
|
|
LOG.info("Loading the INodeDirectory section in parallel with {} sub-" +
|
|
LOG.info("Loading the INodeDirectory section in parallel with {} sub-" +
|
|
"sections", sections.size());
|
|
"sections", sections.size());
|
|
CountDownLatch latch = new CountDownLatch(sections.size());
|
|
CountDownLatch latch = new CountDownLatch(sections.size());
|
|
- final CopyOnWriteArrayList<IOException> exceptions =
|
|
|
|
- new CopyOnWriteArrayList<>();
|
|
|
|
|
|
+ final List<IOException> exceptions = Collections.synchronizedList(new ArrayList<>());
|
|
for (FileSummary.Section s : sections) {
|
|
for (FileSummary.Section s : sections) {
|
|
service.submit(() -> {
|
|
service.submit(() -> {
|
|
InputStream ins = null;
|
|
InputStream ins = null;
|
|
@@ -237,8 +236,7 @@ public final class FSImageFormatPBINode {
|
|
compressionCodec);
|
|
compressionCodec);
|
|
loadINodeDirectorySection(ins);
|
|
loadINodeDirectorySection(ins);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
- LOG.error("An exception occurred loading INodeDirectories in " +
|
|
|
|
- "parallel", e);
|
|
|
|
|
|
+ LOG.error("An exception occurred loading INodeDirectories in parallel", e);
|
|
exceptions.add(new IOException(e));
|
|
exceptions.add(new IOException(e));
|
|
} finally {
|
|
} finally {
|
|
latch.countDown();
|
|
latch.countDown();
|
|
@@ -424,8 +422,7 @@ public final class FSImageFormatPBINode {
|
|
long expectedInodes = 0;
|
|
long expectedInodes = 0;
|
|
CountDownLatch latch = new CountDownLatch(sections.size());
|
|
CountDownLatch latch = new CountDownLatch(sections.size());
|
|
AtomicInteger totalLoaded = new AtomicInteger(0);
|
|
AtomicInteger totalLoaded = new AtomicInteger(0);
|
|
- final CopyOnWriteArrayList<IOException> exceptions =
|
|
|
|
- new CopyOnWriteArrayList<>();
|
|
|
|
|
|
+ final List<IOException> exceptions = Collections.synchronizedList(new ArrayList<>());
|
|
|
|
|
|
for (int i=0; i < sections.size(); i++) {
|
|
for (int i=0; i < sections.size(); i++) {
|
|
FileSummary.Section s = sections.get(i);
|
|
FileSummary.Section s = sections.get(i);
|