Source:
<code>public void invalidateRepositories(Collection<? extends RepositoryInfo> repos, boolean interactive) { if (repos == null || repos.isEmpty()) { repositoryRoots.clear(); repositories.clear(); return; } Map<String, Repository> newrepos = Collections.synchronizedMap(new HashMap<>(repos.size())); Statistics elapsed = new Statistics(); LOGGER.log(Level.FINE, "invalidating {0} repositories", repos.size()); final CountDownLatch latch = new CountDownLatch(repos.size()); final ExecutorService executor = Executors.newFixedThreadPool( Runtime.getRuntime().availableProcessors(), new ThreadFactory() { @Override public Thread newThread(Runnable runnable) { Thread thread = Executors.defaultThreadFactory().newThread(runnable); thread.setName("invalidate-repos-" + thread.getId()); return thread; } }); for (RepositoryInfo rinfo : repos) { executor.submit(new Runnable() { @Override public void run() { try { Repository r = RepositoryFactory.getRepository(rinfo, interactive); if (r == null) { LOGGER.log(Level.WARNING, "Failed to instantiate internal repository data for {0} in {1}", new Object[]{rinfo.getType(), rinfo.getDirectoryName()}); } else { newrepos.put(r.getDirectoryName(), r); } } catch (Exception ex) { LOGGER.log(Level.WARNING, "Could not create " + rinfo.getType() + " for '" + rinfo.getDirectoryName(), ex); } finally { latch.countDown(); } } }); } try { latch.await(); } catch (InterruptedException ex) { LOGGER.log(Level.SEVERE, "latch exception{0}", ex); } executor.shutdown(); repositoryRoots.clear(); repositories.clear(); newrepos.forEach((_key, repo) -> { putRepository(repo); }); <START> elapsed.report(LOGGER, String.format("done invalidating repositories (%d)", newrepos.size())); <END> }</code><technical_language>evident count is number of repos</technical_language>

Target:
public void invalidateRepositories(Collection<? extends RepositoryInfo> repos, boolean interactive) { if (repos == null || repos.isEmpty()) { repositoryRoots.clear(); repositories.clear(); return; } Map<String, Repository> newrepos = Collections.synchronizedMap(new HashMap<>(repos.size())); Statistics elapsed = new Statistics(); LOGGER.log(Level.FINE, "invalidating {0} repositories", repos.size()); final CountDownLatch latch = new CountDownLatch(repos.size()); final ExecutorService executor = Executors.newFixedThreadPool( Runtime.getRuntime().availableProcessors(), new ThreadFactory() { @Override public Thread newThread(Runnable runnable) { Thread thread = Executors.defaultThreadFactory().newThread(runnable); thread.setName("invalidate-repos-" + thread.getId()); return thread; } }); for (RepositoryInfo rinfo : repos) { executor.submit(new Runnable() { @Override public void run() { try { Repository r = RepositoryFactory.getRepository(rinfo, interactive); if (r == null) { LOGGER.log(Level.WARNING, "Failed to instantiate internal repository data for {0} in {1}", new Object[]{rinfo.getType(), rinfo.getDirectoryName()}); } else { newrepos.put(r.getDirectoryName(), r); } } catch (Exception ex) { LOGGER.log(Level.WARNING, "Could not create " + rinfo.getType() + " for '" + rinfo.getDirectoryName(), ex); } finally { latch.countDown(); } } }); } try { latch.await(); } catch (InterruptedException ex) { LOGGER.log(Level.SEVERE, "latch exception{0}", ex); } executor.shutdown(); repositoryRoots.clear(); repositories.clear(); newrepos.forEach((_key, repo) -> { putRepository(repo); }); elapsed.report(LOGGER, String.format("done invalidating %d repositories", newrepos.size())); }