void () { MavenIndex localIndex = myMavenIndices.getIndexHolder().getLocalIndex(); if (localIndex == null) return; Set<File> addedFiles = new TreeSet<>(); Set<File> failedToAddFiles = new TreeSet<>(); synchronized (queueToAdd) { if (stopped.get()) return; if (queueToAdd.isEmpty()) return; Set<File> filesToAddNow = new TreeSet<>(); File elementToAdd; while ((elementToAdd = queueToAdd.poll()) != null) { filesToAddNow.add(elementToAdd); } if (filesToAddNow.isEmpty()) return; Set<File> retryElements = new TreeSet<>(); var addArtifactResponses = localIndex.tryAddArtifacts(filesToAddNow); for (var addArtifactResponse : addArtifactResponses) { var file = addArtifactResponse.artifactFile(); var added = addArtifactResponse.indexedMavenId() != null; if (added) { addedFiles.add(file); } else { retryElements.add(file); } } if (!retryElements.isEmpty()) { if (retryElements.size() < 10_000) { queueToAdd.addAll(retryElements); } else { MavenLog.LOG.error("Failed to index artifacts: " + retryElements.size()); failedToAddFiles.addAll(retryElements); } } } fireUpdated(addedFiles, failedToAddFiles); }