clear cache after closing
This commit is contained in:
@@ -13,7 +13,7 @@ import org.lucares.pdb.blockstorage.BSFile;
|
|||||||
import org.lucares.pdb.blockstorage.LongStreamFile;
|
import org.lucares.pdb.blockstorage.LongStreamFile;
|
||||||
import org.lucares.pdb.diskstorage.DiskStorage;
|
import org.lucares.pdb.diskstorage.DiskStorage;
|
||||||
|
|
||||||
public class PartitionDiskStore {
|
public class PartitionDiskStore implements AutoCloseable {
|
||||||
private final ConcurrentHashMap<ParititionId, DiskStorage> diskStorages = new ConcurrentHashMap<>();
|
private final ConcurrentHashMap<ParititionId, DiskStorage> diskStorages = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
private final Function<ParititionId, DiskStorage> creator;
|
private final Function<ParititionId, DiskStorage> creator;
|
||||||
@@ -61,6 +61,7 @@ public class PartitionDiskStore {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void close() {
|
public void close() {
|
||||||
final List<Throwable> throwables = new ArrayList<>();
|
final List<Throwable> throwables = new ArrayList<>();
|
||||||
|
|
||||||
@@ -71,6 +72,7 @@ public class PartitionDiskStore {
|
|||||||
throwables.add(e);
|
throwables.add(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
diskStorages.clear();
|
||||||
if (!throwables.isEmpty()) {
|
if (!throwables.isEmpty()) {
|
||||||
final RuntimeException ex = new RuntimeException();
|
final RuntimeException ex = new RuntimeException();
|
||||||
throwables.forEach(ex::addSuppressed);
|
throwables.forEach(ex::addSuppressed);
|
||||||
|
|||||||
@@ -150,6 +150,7 @@ public class PartitionPersistentMap<K, V, P> implements AutoCloseable {
|
|||||||
throwables.add(e);
|
throwables.add(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
maps.clear();
|
||||||
if (!throwables.isEmpty()) {
|
if (!throwables.isEmpty()) {
|
||||||
final RuntimeException ex = new RuntimeException();
|
final RuntimeException ex = new RuntimeException();
|
||||||
throwables.forEach(ex::addSuppressed);
|
throwables.forEach(ex::addSuppressed);
|
||||||
|
|||||||
Reference in New Issue
Block a user