Switching to sun.misc.Unsafe as an experiment, easily revertable
This commit is contained in:
parent
8d356ba4a5
commit
4fdf698611
4 changed files with 59 additions and 24 deletions
21
akka-actor/src/main/scala/akka/util/Unsafe.java
Normal file
21
akka-actor/src/main/scala/akka/util/Unsafe.java
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
/**
|
||||
* Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
|
||||
*/
|
||||
|
||||
|
||||
package akka.util;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public final class Unsafe {
|
||||
public final static sun.misc.Unsafe instance;
|
||||
static {
|
||||
try {
|
||||
Field field = sun.misc.Unsafe.class.getDeclaredField("theUnsafe");
|
||||
field.setAccessible(true);
|
||||
instance = (sun.misc.Unsafe) field.get(null);
|
||||
} catch(Throwable t) {
|
||||
throw new ExceptionInInitializerError(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue