public void invalidate(final UpdatedFiles updatedFiles) { final Map<String, RemoteDifferenceStrategy> strategyMap; synchronized (myLock) { strategyMap = new HashMap<String, RemoteDifferenceStrategy>(myKinds); } final Collection<String> newForTree = new LinkedList<String>(); final Collection<String> newForUsual = new LinkedList<String>(); UpdateFilesHelper.iterateAffectedFiles( updatedFiles, new Consumer<Pair<String, String>>() { public void consume(final Pair<String, String> pair) { final String vcsName = pair.getSecond(); RemoteDifferenceStrategy strategy = strategyMap.get(vcsName); if (strategy == null) { final AbstractVcs vcs = myVcsManager.findVcsByName(vcsName); if (vcs == null) return; strategy = vcs.getRemoteDifferenceStrategy(); } if (RemoteDifferenceStrategy.ASK_TREE_PROVIDER.equals(strategy)) { newForTree.add(pair.getFirst()); } else { newForUsual.add(pair.getFirst()); } } }); myRemoteRevisionsStateCache.invalidate(newForTree); myRemoteRevisionsNumbersCache.invalidate(newForUsual); }