Add a RandomAccessFile which doesn't resource leak on a GC, https://github.com/OpenHFT/Chronicle-Core/issues/108

This commit is contained in:
Peter Lawrey
2020-05-07 11:33:10 +01:00
parent cf0b6cc7e1
commit 9b1d3f6393
2 changed files with 5 additions and 3 deletions
@@ -16,6 +16,7 @@
package net.openhft.chronicle.hash.impl.util;
import net.openhft.chronicle.core.CleaningRandomAccessFile;
import net.openhft.chronicle.core.Jvm;
import java.io.File;
@@ -36,7 +37,7 @@ public final class CanonicalRandomAccessFiles {
return canonicalRafs.compute(file, (f, ref) -> {
if (ref == null) {
try {
return new RafReference(new RandomAccessFile(f, "rw"));
return new RafReference(new CleaningRandomAccessFile(f, "rw"));
} catch (FileNotFoundException e) {
throw Jvm.rethrow(e);
}