mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
use a more memory-efficient structure to hold a long indexed file list
This commit is contained in:
@@ -33,7 +33,7 @@ import java.util.*;
|
||||
public class CacheUpdateSession {
|
||||
private static final Logger LOG = Logger.getInstance("#" + CacheUpdateSession.class.getName());
|
||||
private static final Key<Boolean> FAILED_TO_INDEX = Key.create(CacheUpdateSession.class.getSimpleName() + ".FAILED_TO_INDEX");
|
||||
private final Collection<VirtualFile> myFilesToUpdate;
|
||||
private final List<VirtualFile> myFilesToUpdate;
|
||||
private final int myJobsToDo;
|
||||
private final List<Pair<CacheUpdater, Collection<VirtualFile>>> myUpdatersWithFiles =
|
||||
new ArrayList<Pair<CacheUpdater, Collection<VirtualFile>>>();
|
||||
@@ -41,7 +41,7 @@ public class CacheUpdateSession {
|
||||
public CacheUpdateSession(Collection<CacheUpdater> updaters, ProgressIndicator indicator) {
|
||||
List<CacheUpdater> processedUpdaters = new ArrayList<CacheUpdater>();
|
||||
|
||||
myFilesToUpdate = new LinkedHashSet<VirtualFile>();
|
||||
LinkedHashSet<VirtualFile> set = ContainerUtil.newLinkedHashSet();
|
||||
try {
|
||||
int jobsCount = 0;
|
||||
for (CacheUpdater each : updaters) {
|
||||
@@ -50,7 +50,7 @@ public class CacheUpdateSession {
|
||||
jobsCount += each.getNumberOfPendingUpdateJobs();
|
||||
List<VirtualFile> updaterFiles = Arrays.asList(each.queryNeededFiles(indicator));
|
||||
processedUpdaters.add(each);
|
||||
myFilesToUpdate.addAll(updaterFiles);
|
||||
set.addAll(updaterFiles);
|
||||
myUpdatersWithFiles.add(Pair.create(each, (Collection<VirtualFile>)new THashSet<VirtualFile>(updaterFiles)));
|
||||
}
|
||||
catch (ProcessCanceledException e) {
|
||||
@@ -68,6 +68,7 @@ public class CacheUpdateSession {
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
myFilesToUpdate = ContainerUtil.newArrayList(set);
|
||||
}
|
||||
|
||||
public int getNumberOfPendingUpdateJobs() {
|
||||
|
||||
Reference in New Issue
Block a user