mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fixed facet autodetection for multi-threaded cache updaters [rev by D.Avdeev]
This commit is contained in:
+16
-13
@@ -76,6 +76,7 @@ public class FacetAutodetectingManagerImpl extends FacetAutodetectingManager imp
|
||||
private boolean myDetectionInProgress;
|
||||
private final Set<FacetType<?,?>> myFacetTypesWithDetectors = new THashSet<FacetType<?,?>>();
|
||||
private final EnableAutodetectionWorker myEnableAutodetectionWorker;
|
||||
private final Object myLock = new Object();
|
||||
|
||||
public FacetAutodetectingManagerImpl(final Project project, PsiManager psiManager, FacetPointersManager facetPointersManager) {
|
||||
myProject = project;
|
||||
@@ -162,22 +163,24 @@ public class FacetAutodetectingManagerImpl extends FacetAutodetectingManager imp
|
||||
Collection<FacetDetectorWrapper> detectors = myDetectors.get(fileType);
|
||||
if (detectors == null) return;
|
||||
|
||||
List<FacetInfo2<Module>> facets = null;
|
||||
for (FacetDetectorWrapper<?,?,?,?> detector : detectors) {
|
||||
facets = process(file, fileContent, detector, facets);
|
||||
}
|
||||
synchronized (myLock) {
|
||||
List<FacetInfo2<Module>> facets = null;
|
||||
for (FacetDetectorWrapper<?,?,?,?> detector : detectors) {
|
||||
facets = process(file, fileContent, detector, facets);
|
||||
}
|
||||
|
||||
String url = file.getUrl();
|
||||
FacetDetectionIndexEntry indexEntry = myFileIndex.getIndexEntry(url);
|
||||
if (indexEntry == null) {
|
||||
indexEntry = new FacetDetectionIndexEntry(file.getTimeStamp());
|
||||
}
|
||||
String url = file.getUrl();
|
||||
FacetDetectionIndexEntry indexEntry = myFileIndex.getIndexEntry(url);
|
||||
if (indexEntry == null) {
|
||||
indexEntry = new FacetDetectionIndexEntry(file.getTimeStamp());
|
||||
}
|
||||
|
||||
Collection<Integer> removed = indexEntry.update(myFacetPointersManager, facets);
|
||||
myFileIndex.putIndexEntry(url, indexEntry);
|
||||
Collection<Integer> removed = indexEntry.update(myFacetPointersManager, facets);
|
||||
myFileIndex.putIndexEntry(url, indexEntry);
|
||||
|
||||
if (removed != null) {
|
||||
removeObsoleteFacets(removed);
|
||||
if (removed != null) {
|
||||
removeObsoleteFacets(removed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user