ensure initialized state is visible to other threads

This commit is contained in:
Eugene Zhuravlev
2012-06-19 17:24:10 +02:00
parent 4e214e78ca
commit eaea211c36
@@ -125,7 +125,7 @@ public class FileBasedIndexImpl extends FileBasedIndex {
@Nullable private ScheduledFuture<?> myFlushingFuture;
private volatile int myLocalModCount;
private volatile int myFilesModCount;
private volatile boolean myInitialized; // need this variable for memory barrier
@Override
public void requestReindex(@NotNull final VirtualFile file) {
myChangedFilesCollector.invalidateIndices(file, true);
@@ -347,7 +347,7 @@ public class FileBasedIndexImpl extends FileBasedIndex {
lastModCount = myLocalModCount;
}
});
myInitialized = true; // this will ensure that all changes to component's state will be visible to other threads
}
}