Source:
<code>public Map<FingerprintIdDetails, Fingerprint> fingerprintFiles(final Collection<File> files, final int threads, final int waitTime, final TimeUnit waitTimeUnit) { final AtomicInteger filesRead = new AtomicInteger(0); final ExecutorService executor = Executors.newFixedThreadPool(threads, new ThreadFactoryBuilder().setDaemon(true).build()); final IntervalList intervals = this.haplotypes.getIntervalList(); final Map<FingerprintIdDetails, Fingerprint> retval = new ConcurrentHashMap<>(); final Map<Future<?>, File> futures = new HashMap<>(files.size()); for (final File f : files) { futures.put(executor.submit(() -> { try { if (CheckFingerprint.isBamOrSamFile(f)) { retval.putAll(fingerprintSamFile(f, intervals)); } else { retval.putAll(fingerprintVcf(f)); } <START> synchronized (log) { <END> log.debug("Processed file: " + f.getAbsolutePath() + " (" + filesRead.get() + ")"); } if (filesRead.incrementAndGet() % 100 == 0) { synchronized (log) { log.info("Processed " + filesRead.get() + " out of " + files.size()); } } } catch(final Exception e) { log.warn("Exception thrown in thread:" + e.getMessage()); throw e; } }), f); } executor.shutdown(); try { executor.awaitTermination(waitTime, waitTimeUnit); } catch (final InterruptedException ie) { log.warn(ie, "Interrupted while waiting for executor to terminate."); } for (final Map.Entry<Future<?>, File> futureFileEntry : futures.entrySet()) { try { futureFileEntry.getKey().get(); } catch (InterruptedException | ExecutionException e) { log.error("Failed to fingerprint on file: " + futureFileEntry.getValue()); throw new RuntimeException(e); } } return retval; }</code><technical_language>Weird, sense I think</technical_language>

Target:
public Map<FingerprintIdDetails, Fingerprint> fingerprintFiles(final Collection<File> files, final int threads, final int waitTime, final TimeUnit waitTimeUnit) { final AtomicInteger filesRead = new AtomicInteger(0); final ExecutorService executor = Executors.newFixedThreadPool(threads, new ThreadFactoryBuilder().setDaemon(true).build()); final IntervalList intervals = this.haplotypes.getIntervalList(); final Map<FingerprintIdDetails, Fingerprint> retval = new ConcurrentHashMap<>(); final Map<Future<?>, File> futures = new HashMap<>(files.size()); for (final File f : files) { futures.put(executor.submit(() -> { try { if (CheckFingerprint.isBamOrSamFile(f)) { retval.putAll(fingerprintSamFile(f, intervals)); } else { retval.putAll(fingerprintVcf(f)); } log.debug("Processed file: " + f.getAbsolutePath() + " (" + filesRead.get() + ")"); if (filesRead.incrementAndGet() % 100 == 0) { log.info("Processed " + filesRead.get() + " out of " + files.size()); } } catch (final Exception e) { log.warn("Exception thrown in thread:" + e.getMessage()); throw e; } }), f); } executor.shutdown(); try { executor.awaitTermination(waitTime, waitTimeUnit); } catch (final InterruptedException ie) { log.warn(ie, "Interrupted while waiting for executor to terminate."); } for (final Map.Entry<Future<?>, File> futureFileEntry : futures.entrySet()) { try { futureFileEntry.getKey().get(); } catch (InterruptedException | ExecutionException e) { log.error("Failed to fingerprint on file: " + futureFileEntry.getValue()); throw new RuntimeException(e); } } return retval; }