mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[log] Flush & Close persistent enumerator on dispose()
This commit is contained in:
@@ -15,7 +15,9 @@
|
||||
*/
|
||||
package com.intellij.vcs.log.data;
|
||||
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.ThrowableComputable;
|
||||
import com.intellij.util.io.IOUtil;
|
||||
@@ -35,9 +37,10 @@ import java.io.IOException;
|
||||
/**
|
||||
* Supports the int <-> Hash persistent mapping.
|
||||
*/
|
||||
class VcsLogHashMap {
|
||||
class VcsLogHashMap implements Disposable {
|
||||
|
||||
private static final File LOG_CACHE_APP_DIR = new File(PathManager.getSystemPath(), "vcs-log");
|
||||
private static final Logger LOG = Logger.getInstance(VcsLogHashMap.class);
|
||||
|
||||
private final PersistentEnumerator<Hash> myPersistentEnumerator;
|
||||
|
||||
@@ -60,6 +63,16 @@ class VcsLogHashMap {
|
||||
return myPersistentEnumerator.enumerate(hash);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
try {
|
||||
myPersistentEnumerator.close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
LOG.warn(e);
|
||||
}
|
||||
}
|
||||
|
||||
private static class MyHashKeyDescriptor implements KeyDescriptor<Hash> {
|
||||
@Override
|
||||
public void save(DataOutput out, Hash value) throws IOException {
|
||||
|
||||
Reference in New Issue
Block a user