From 408db92fa41508bd8835da8b9602f952a4fd8086 Mon Sep 17 00:00:00 2001 From: Dmitry Pisklov Date: Thu, 2 Aug 2018 16:10:09 +0100 Subject: [PATCH] Improve Java 11 support --- .../net/openhft/chronicle/hash/impl/util/CleanerUtils.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/openhft/chronicle/hash/impl/util/CleanerUtils.java b/src/main/java/net/openhft/chronicle/hash/impl/util/CleanerUtils.java index bed09bd07..aa24b07bc 100644 --- a/src/main/java/net/openhft/chronicle/hash/impl/util/CleanerUtils.java +++ b/src/main/java/net/openhft/chronicle/hash/impl/util/CleanerUtils.java @@ -16,9 +16,11 @@ public class CleanerUtils { static { try { - Class cleanerClass = Class.forName(Jvm.isJava9Plus() ? "jdk.internal.ref.Cleaner" : "sun.misc.Cleaner"); + Class cleanerClass = Class.forName(Jvm.isJava9Plus() ? "jdk.internal.ref.Cleaner" : "sun.misc.Cleaner"); CREATE_METHOD = cleanerClass.getDeclaredMethod("create", Object.class, Runnable.class); + Jvm.setAccessible(CREATE_METHOD); CLEAN_METHOD = cleanerClass.getDeclaredMethod("clean"); + Jvm.setAccessible(CLEAN_METHOD); } catch (ClassNotFoundException | NoSuchMethodException e) { LOGGER.error("Unable to initialise CleanerUtils", e); throw new RuntimeException(e);