MavenServerConnector (@Nullable MavenServerConnector connector) { if (connector == null) return null; synchronized (myMultimoduleDirToConnectorMap) { if (myIndexingConnector == connector) { myIndexingConnector = null; myIndexerWrapper = null; return connector; } if (!myMultimoduleDirToConnectorMap.containsValue(connector)) { return null; } myMultimoduleDirToConnectorMap.entrySet().removeIf(e -> e.getValue() == connector); } return connector; }