use of sun.misc.Unsafe in project voltdb by VoltDB.
the class UtilUnsafe method getUnsafe.
/** Fetch the Unsafe. Use With Caution. */
public static Unsafe getUnsafe() {
// Not on bootclasspath
if (UtilUnsafe.class.getClassLoader() == null)
return Unsafe.getUnsafe();
try {
final Field fld = Unsafe.class.getDeclaredField("theUnsafe");
fld.setAccessible(true);
return (Unsafe) fld.get(UtilUnsafe.class);
} catch (Exception e) {
throw new RuntimeException("Could not obtain access to sun.misc.Unsafe", e);
}
}
use of sun.misc.Unsafe in project ignite by apache.
the class GridUnsafe method unsafe.
/**
* @return Instance of Unsafe class.
*/
private static Unsafe unsafe() {
try {
return Unsafe.getUnsafe();
} catch (SecurityException ignored) {
try {
return AccessController.doPrivileged(new PrivilegedExceptionAction<Unsafe>() {
@Override
public Unsafe run() throws Exception {
Field f = Unsafe.class.getDeclaredField("theUnsafe");
f.setAccessible(true);
return (Unsafe) f.get(null);
}
});
} catch (PrivilegedActionException e) {
throw new RuntimeException("Could not initialize intrinsics.", e.getCause());
}
}
}
use of sun.misc.Unsafe in project algorithms by Iurii-Dziuban.
the class CrashStringTest method getUnsafe.
public static Unsafe getUnsafe() {
try {
Field field = Unsafe.class.getDeclaredField("theUnsafe");
field.setAccessible(true);
return (Unsafe) field.get(null);
} catch (Exception ex) {
throw new RuntimeException("can't get Unsafe instance", ex);
}
}
use of sun.misc.Unsafe in project algorithms by Iurii-Dziuban.
the class NotValidAddressCrashTest method getUnsafe.
private static Unsafe getUnsafe() {
try {
Field field = Unsafe.class.getDeclaredField("theUnsafe");
field.setAccessible(true);
return (Unsafe) field.get(null);
} catch (Exception ex) {
throw new RuntimeException("can't get Unsafe instance", ex);
}
}
Aggregations