use of com.intellij.util.indexing.StorageException in project intellij-community by JetBrains.
the class CompilerReferenceServiceImpl method calculateDirectInheritors.
private Map<VirtualFile, Object[]> calculateDirectInheritors(@NotNull PsiNamedElement aClass, @NotNull GlobalSearchScope useScope, @NotNull FileType searchFileType, @NotNull CompilerHierarchySearchType searchType) {
final CompilerElementInfo searchElementInfo = asCompilerElements(aClass, false);
if (searchElementInfo == null)
return null;
LightRef searchElement = searchElementInfo.searchElements[0];
myReadDataLock.lock();
try {
if (myReader == null)
return null;
try {
return myReader.getDirectInheritors(searchElement, useScope, myDirtyScopeHolder.getDirtyScope(), searchFileType, searchType);
} catch (StorageException e) {
throw new RuntimeException(e);
}
} finally {
myReadDataLock.unlock();
}
}
use of com.intellij.util.indexing.StorageException in project intellij-community by JetBrains.
the class MapIndexStorage method close.
@Override
public void close() throws StorageException {
try {
flush();
myMap.close();
} catch (IOException e) {
throw new StorageException(e);
} catch (RuntimeException e) {
unwrapCauseAndRethrow(e);
}
}
use of com.intellij.util.indexing.StorageException in project intellij-community by JetBrains.
the class MapIndexStorage method addValue.
@Override
public void addValue(final Key key, final int inputId, final Value value) throws StorageException {
if (myReadOnly) {
throw new IncorrectOperationException("Index storage is read-only");
}
try {
myMap.markDirty();
if (!myKeyIsUniqueForIndexedFile) {
read(key).addValue(inputId, value);
return;
}
ChangeTrackingValueContainer<Value> cached;
try {
l.lock();
cached = myCache.getIfCached(key);
} finally {
l.unlock();
}
if (cached != null) {
cached.addValue(inputId, value);
return;
}
// do not pollute the cache with keys unique to indexed file
ChangeTrackingValueContainer<Value> valueContainer = new ChangeTrackingValueContainer<Value>(null);
valueContainer.addValue(inputId, value);
myMap.put(key, valueContainer);
} catch (IOException e) {
throw new StorageException(e);
}
}
use of com.intellij.util.indexing.StorageException in project intellij-community by JetBrains.
the class VcsLogPersistentIndex method filterMessages.
@NotNull
public TIntHashSet filterMessages(@NotNull VcsLogTextFilter filter) {
if (myIndexStorage != null) {
try {
if (!filter.isRegex()) {
TIntHashSet commitsForSearch = myIndexStorage.trigrams.getCommitsForSubstring(filter.getText());
if (commitsForSearch != null) {
TIntHashSet result = new TIntHashSet();
commitsForSearch.forEach(commit -> {
try {
String value = myIndexStorage.messages.get(commit);
if (value != null) {
if (VcsLogTextFilterImpl.matches(filter, value)) {
result.add(commit);
}
}
} catch (IOException e) {
myFatalErrorsConsumer.consume(this, e);
return false;
}
return true;
});
return result;
}
}
} catch (StorageException e) {
myFatalErrorsConsumer.consume(this, e);
} catch (RuntimeException e) {
processRuntimeException(e);
}
return filter(myIndexStorage.messages, message -> VcsLogTextFilterImpl.matches(filter, message));
}
return EmptyIntHashSet.INSTANCE;
}
Aggregations