IDEA-COMMUNITY-CR-2175 (explicit archive handler cleanup)

This commit is contained in:
Roman Shevchenko
2015-05-19 16:49:28 +02:00
parent 159b557768
commit caf42ff54d
3 changed files with 8 additions and 1 deletions
@@ -92,6 +92,10 @@ public abstract class ArchiveHandler {
return ArrayUtil.toStringArray(names);
}
public void dispose() {
myEntries.clear();
}
@Nullable
protected EntryInfo getEntryInfo(@NotNull String relativePath) {
return getEntriesMap().get(relativePath);
@@ -119,7 +119,9 @@ public class ZipHandler extends ArchiveHandler {
return getFile();
}
public void dispose() { // todo it would be nice to dispose ZipHandler
@Override
public void dispose() {
super.dispose();
ourZipFileFileAccessorCache.remove(this);
}
@@ -302,6 +302,7 @@ public class VfsImplUtil {
static InvalidationState invalidate(@Nullable InvalidationState state, final String path) {
Pair<ArchiveFileSystem, ArchiveHandler> handlerPair = ourHandlers.remove(path);
if (handlerPair != null) {
handlerPair.second.dispose();
forEachDirectoryComponent(path, new Consumer<String>() {
@Override
public void consume(String containingDirectoryPath) {