Source:
<code>void loadINodeSectionInParallel(ExecutorService service, ArrayList<FileSummary.Section> sections, String compressionCodec, StartupProgress prog, Step currentStep) throws IOException { LOG.info("Loading the INode section in parallel with sub-sections", sections.size()); CountDownLatch latch = new CountDownLatch(sections.size()); AtomicInteger totalLoaded = new AtomicInteger(0); final CopyOnWriteArrayList<IOException> exceptions = new CopyOnWriteArrayList<>(); for (int i=0; i < sections.size(); i++) { FileSummary.Section s = sections.get(i); InputStream ins = parent.getInputStreamForSection(s, compressionCodec); if (i == 0) { loadINodeSectionHeader(ins, prog, currentStep); } service.submit(new Runnable() { public void run() { try { totalLoaded.addAndGet(loadINodesInSection(ins, null)); prog.setCount(Phase.LOADING_FSIMAGE, currentStep, totalLoaded.get()); } catch (Exception e) { LOG.error("An exception occurred loading INodes in parallel", e); exceptions.add(new IOException(e)); } finally { latch.countDown(); try { ins.close(); } catch (IOException ioe) { LOG.warn("Failed to close the input stream, ignoring", ioe); } } } }); } try { <START> latch.await(); <END> } catch (InterruptedException e) { LOG.info("Interrupted waiting for countdown latch"); } if (exceptions.size() != 0) { LOG.error("{} exceptions occurred loading INodes", exceptions.size()); throw exceptions.get(0); } LOG.info("Completed loading all INode sections. Loaded inodes.", totalLoaded.get()); }</code><technical_language>some exceptions invisible users? easy get root if meet some exceptions core exception is head</technical_language>

Target:
void loadINodeSectionInParallel(ExecutorService service, ArrayList<FileSummary.Section> sections, String compressionCodec, StartupProgress prog, Step currentStep) throws IOException { LOG.info("Loading the INode section in parallel with sub-sections", sections.size()); long expectedInodes = 0; CountDownLatch latch = new CountDownLatch(sections.size()); AtomicInteger totalLoaded = new AtomicInteger(0); final CopyOnWriteArrayList<IOException> exceptions = new CopyOnWriteArrayList<>(); for (int i=0; i < sections.size(); i++) { FileSummary.Section s = sections.get(i); InputStream ins = parent.getInputStreamForSection(s, compressionCodec); if (i == 0) { expectedInodes = loadINodeSectionHeader(ins, prog, currentStep); } service.submit(() -> { try { totalLoaded.addAndGet(loadINodesInSection(ins, null)); prog.setCount(Phase.LOADING_FSIMAGE, currentStep, totalLoaded.get()); } catch (Exception e) { LOG.error("An exception occurred loading INodes in parallel", e); exceptions.add(new IOException(e)); } finally { latch.countDown(); try { ins.close(); } catch (IOException ioe) { LOG.warn("Failed to close the input stream, ignoring", ioe); } } }); } try { latch.await(); } catch (InterruptedException e) { LOG.info("Interrupted waiting for countdown latch"); } if (exceptions.size() != 0) { LOG.error("{} exceptions occurred loading INodes", exceptions.size()); throw exceptions.get(0); } if (totalLoaded.get() != expectedInodes) { throw new IOException("Expected to load "+expectedInodes+" in " + "parallel, but loaded "+totalLoaded.get()+". The image may " + "be corrupt."); } LOG.info("Completed loading all INode sections. Loaded inodes.", totalLoaded.get()); }