List<AddArtifactResponse> (@NotNull Collection<File> artifactFiles) { var failedResponses = ContainerUtil.map(artifactFiles, file -> new AddArtifactResponse(file, null)); return doIndexAndRecoveryTask(() -> { boolean locked = indexUpdateLock.tryLock(); if (!locked) return failedResponses; try { IndexData indexData = myData; if (indexData != null) { var addArtifactResponses = indexData.addArtifacts(artifactFiles); for (var addArtifactResponse : addArtifactResponses) { var id = addArtifactResponse.indexedMavenId(); if (id != null) { String groupWithArtifact = id.groupId + ":" + id.artifactId; addToCache(indexData.groupToArtifactMap, id.groupId, id.artifactId); addToCache(indexData.groupWithArtifactToVersionMap, groupWithArtifact, id.version); if ("maven-archetype".equals(id.packaging)) { addToCache(indexData.archetypeIdToDescriptionMap, groupWithArtifact, id.version + ":" + StringUtil.notNullize(id.description)); } } } indexData.flush(); return addArtifactResponses; } return failedResponses; } finally { indexUpdateLock.unlock(); } }, failedResponses); }