Simple class to obtain access to the Unsafe object.
More...
|
static final long | fieldOffset (Class clz, String field) |
|
Simple class to obtain access to the Unsafe object.
Unsafe is required to allow efficient CAS operations on arrays. Note that the versions in java.util.concurrent.atomic, such as {}, require extra memory ordering guarantees which are generally not needed in these algorithms and are also expensive on most processors.
Definition at line 15 of file UtilUnsafe.java.
◆ UtilUnsafe()
com.cliffc.aa.util.UtilUnsafe.UtilUnsafe |
( |
| ) |
|
|
private |
◆ fieldOffset()
static final long com.cliffc.aa.util.UtilUnsafe.fieldOffset |
( |
Class |
clz, |
|
|
String |
field |
|
) |
| |
|
staticpackage |
◆ getUnsafe()
static Unsafe com.cliffc.aa.util.UtilUnsafe.getUnsafe |
( |
| ) |
|
|
static |
Fetch the Unsafe.
Use With Caution.
Definition at line 19 of file UtilUnsafe.java.
21 if(
UtilUnsafe.class.getClassLoader() ==
null )
22 return Unsafe.getUnsafe();
24 final Field fld = Unsafe.class.getDeclaredField(
"theUnsafe");
25 fld.setAccessible(
true);
27 }
catch (Exception e) {
28 throw new RuntimeException(
"Could not obtain access to sun.misc.Unsafe", e);
◆ UNSAFE
final Unsafe com.cliffc.aa.util.UtilUnsafe.UNSAFE = getUnsafe() |
|
staticpackage |
The documentation for this class was generated from the following file: