IDEA-219033 - artifact added to index if it exists in local repo and not present in index - removed queue

GitOrigin-RevId: f6ee75b6b74d3ba0feb649ce9698c977d4704fac
This commit is contained in:
Alexander Bubenchikov
2019-08-05 12:12:49 +03:00
committed by intellij-monorepo-bot
parent da7188a4b5
commit 3c797d00cf
@@ -13,8 +13,6 @@ import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.JdomKt;
import com.intellij.util.io.PathKt;
import com.intellij.util.ui.update.MergingUpdateQueue;
import com.intellij.util.ui.update.Update;
import gnu.trove.THashSet;
import org.jdom.Element;
import org.jdom.JDOMException;
@@ -432,14 +430,19 @@ public class MavenIndicesManager implements Disposable {
private static class IndexFixer {
private final MergingUpdateQueue myMergingUpdateQueue =
new MergingUpdateQueue(this.getClass().getName(), 1000, true, MergingUpdateQueue.ANY_COMPONENT, null, null, false);
private final static Set<String> INDEXED = Collections.newSetFromMap(new WeakHashMap<>());
public void fixIndex(File file, MavenIndex index) {
myMergingUpdateQueue.queue(new Update(file.getPath()) {
@Override
public void run() {
index.addArtifact(file);
synchronized (INDEXED) {
if (INDEXED.contains(file.getName())) {
return;
}
}
ApplicationManager.getApplication().executeOnPooledThread(() -> {
index.addArtifact(file);
synchronized (INDEXED) {
INDEXED.add(file.getName());
}
});
}