diff --git a/sentinel-core/src/main/java/com/alibaba/csp/sentinel/eagleeye/EagleEyeCoreUtils.java b/sentinel-core/src/main/java/com/alibaba/csp/sentinel/eagleeye/EagleEyeCoreUtils.java index 8874f721..615c73b7 100755 --- a/sentinel-core/src/main/java/com/alibaba/csp/sentinel/eagleeye/EagleEyeCoreUtils.java +++ b/sentinel-core/src/main/java/com/alibaba/csp/sentinel/eagleeye/EagleEyeCoreUtils.java @@ -194,44 +194,4 @@ final class EagleEyeCoreUtils { } } - // Unsafe mechanics - @SuppressWarnings("restriction") - private static final sun.misc.Unsafe UNSAFE = doGetUnsafe(); - - @SuppressWarnings("restriction") - public static sun.misc.Unsafe getUnsafe() { - return UNSAFE; - } - - /** - * Returns a sun.misc.Unsafe. Suitable for use in a 3rd party package. - * Replace with a simple call to Unsafe.getUnsafe when integrating into a - * jdk. - * - * @return a sun.misc.Unsafe - */ - @SuppressWarnings("restriction") - private static sun.misc.Unsafe doGetUnsafe() { - try { - return sun.misc.Unsafe.getUnsafe(); - } catch (Throwable tryReflectionInstead) { - } - try { - return java.security.AccessController - .doPrivileged(new java.security.PrivilegedExceptionAction() { - @Override - public sun.misc.Unsafe run() throws Exception { - Class k = sun.misc.Unsafe.class; - for (java.lang.reflect.Field f : k.getDeclaredFields()) { - f.setAccessible(true); - Object x = f.get(null); - if (k.isInstance(x)) { return k.cast(x); } - } - throw new NoSuchFieldError("the Unsafe"); - } - }); - } catch (Throwable t) { - return null; - } - } }