Switching to sun.misc.Unsafe as an experiment, easily revertable

This commit is contained in:
Viktor Klang 2011-11-21 17:49:21 +01:00
parent 8d356ba4a5
commit 4fdf698611
4 changed files with 59 additions and 24 deletions

View 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);
}
}
}