=act #18007 remove reference to scala.concurrent.util.Unsafe
This commit is contained in:
parent
f9201c7e05
commit
f3c6ff5665
1 changed files with 20 additions and 3 deletions
|
|
@ -1,13 +1,30 @@
|
|||
/**
|
||||
* Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com>
|
||||
*/
|
||||
|
||||
|
||||
package akka.util;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
/**
|
||||
* INTERNAL API
|
||||
*/
|
||||
public final class Unsafe {
|
||||
public final static sun.misc.Unsafe instance = scala.concurrent.util.Unsafe.instance;
|
||||
public final static sun.misc.Unsafe instance;
|
||||
|
||||
static {
|
||||
try {
|
||||
sun.misc.Unsafe found = null;
|
||||
for (Field field : sun.misc.Unsafe.class.getDeclaredFields()) {
|
||||
if (field.getType() == sun.misc.Unsafe.class) {
|
||||
field.setAccessible(true);
|
||||
found = (sun.misc.Unsafe) field.get(null);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found == null) throw new IllegalStateException("Can't find instance of sun.misc.Unsafe");
|
||||
else instance = found;
|
||||
} catch (Throwable t) {
|
||||
throw new ExceptionInInitializerError(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue