Use AtomicInteger.class ClassLoader for Unsafe dection. See #102
This commit is contained in:
parent
766525431d
commit
5cb865c4ce
@ -15,6 +15,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.jboss.netty.util;
|
package org.jboss.netty.util;
|
||||||
|
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility which checks if {@value #UNSAFE} class can be found in the classpath
|
* Utility which checks if {@value #UNSAFE} class can be found in the classpath
|
||||||
@ -28,6 +30,7 @@ package org.jboss.netty.util;
|
|||||||
public class UnsafeDetectUtil {
|
public class UnsafeDetectUtil {
|
||||||
|
|
||||||
private static final String UNSAFE = "sun.misc.Unsafe";
|
private static final String UNSAFE = "sun.misc.Unsafe";
|
||||||
|
private static final boolean UNSAFE_FOUND = isUnsafeFound(AtomicInteger.class.getClassLoader());
|
||||||
|
|
||||||
public static boolean isUnsafeFound(ClassLoader loader) {
|
public static boolean isUnsafeFound(ClassLoader loader) {
|
||||||
try {
|
try {
|
||||||
@ -39,7 +42,7 @@ public class UnsafeDetectUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isUnsafeFound() {
|
public static boolean isUnsafeFound() {
|
||||||
return isUnsafeFound(UnsafeDetectUtil.class.getClassLoader());
|
return UNSAFE_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
private UnsafeDetectUtil() {
|
private UnsafeDetectUtil() {
|
||||||
|
Loading…
Reference in New Issue
Block a user