Class UnsafeAccess



  • public final class UnsafeAccess
    extends Object
    All use of this class MUST first check that UnsafeAccess.isUnsafeAvailable() == true otherwise NPEs will happen in environments without "suc.misc.Unsafe" such as Android.
    • Field Detail

      • UNSAFE

        public static final sun.misc.Unsafe UNSAFE
    • Method Detail

      • isUnsafeAvailable

        public static final boolean isUnsafeAvailable()
      • getAndIncrementInt

        public static int getAndIncrementInt(Object obj,
                                             long offset)
      • getAndAddInt

        public static int getAndAddInt(Object obj,
                                       long offset,
                                       int n)
      • getAndSetInt

        public static int getAndSetInt(Object obj,
                                       long offset,
                                       int newValue)
      • compareAndSwapInt

        public static boolean compareAndSwapInt(Object obj,
                                                long offset,
                                                int expected,
                                                int newValue)