void (boolean wait) { Collection<MavenServerConnector> values; synchronized (myMultimoduleDirToConnectorMap) { values = new ArrayList<>(myMultimoduleDirToConnectorMap.values()); } shutdownConnector(myIndexingConnector, wait); values.forEach(c -> shutdownConnector(c, wait)); }