move to use CleanerUtils to choose correct location of Cleaner based on java version

This commit is contained in:
Tom Shercliff
2018-07-19 14:44:41 +01:00
parent 9891b40949
commit 25ec7d7490
@@ -21,6 +21,8 @@ import com.google.common.collect.Lists;
import net.openhft.chronicle.bytes.NoBytesStore;
import net.openhft.chronicle.core.OS;
import net.openhft.chronicle.core.values.IntValue;
import net.openhft.chronicle.hash.impl.util.Cleaner;
import net.openhft.chronicle.hash.impl.util.CleanerUtils;
import net.openhft.chronicle.hash.serialization.impl.StringSizedReader;
import net.openhft.chronicle.hash.serialization.impl.StringUtf8DataAccess;
import net.openhft.chronicle.values.Values;
@@ -28,7 +30,6 @@ import org.junit.*;
import org.junit.rules.TemporaryFolder;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import sun.misc.Cleaner;
import java.io.IOException;
import java.io.PrintWriter;
@@ -225,7 +226,7 @@ public class MemoryLeaksTest {
CountedStringReader() {
serializerCount.incrementAndGet();
serializers.add(new WeakReference<>(this));
cleaner = Cleaner.create(this, serializerCount::decrementAndGet);
cleaner = CleanerUtils.createCleaner(this, serializerCount::decrementAndGet);
try (StringWriter stringWriter = new StringWriter();
PrintWriter printWriter = new PrintWriter(stringWriter)) {
new Exception().printStackTrace(printWriter);